Hi @gelion42 ,
I hope you’re doing fine.
There is no such option in ReviewX to limit the character of a review comment.
However, we can provide you with a snippet code, so we need some more information to proceed.
Would you please contact our support?
Our dedicated support team will take care of it.
Have a nice day. 🙂
Thanks & regards.
Hello,
Thanks for your reply.
Yes, Could you provide me the code here?
Hi @gelion42 ,
Would you please tell me what the minimum and maximum character limits would be?
Best regards 🙂
Hi @gelion42 ,
Please use the following JS code snippet, which will limit the comment length to 10 characters by default. If you want, you can change the character count as needed.
const textarea = document.getElementById('comment');
const maxWordsLimit = 10; // Change this to your desired word limit
// Function to update word count and control input
function updateWordCountAndControlInput() {
const words = textarea.value.trim().split(/\s+/); // Split by whitespace
const wordCount = words.length === 1 && words[0] === '' ? 0 : words.length;
if (wordCount >= maxWordsLimit) {
textarea.value = words.slice(0, maxWordsLimit).join(' ');
textarea.removeEventListener('input', updateWordCountAndControlInput);
textarea.disabled = true;
}
}
// Add input event listener to the textarea
textarea.addEventListener('input', updateWordCountAndControlInput);
// Initial setup
maxWordsDisplay.textContent = maxWordsLimit;
Feel free to let me know if you need any further assistance.
Have a nice day. 🙂