Last active
September 4, 2023 20:27
-
-
Save ahsannayem/5edfb69c323d61b0a4f7c24cd1a57855 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const textarea = document.getElementById('TextArea_ID'); // Replace the id | |
textarea.addEventListener('input', function() { | |
const minTextLength = 10; // Set Minimum required text length | |
if (textarea.value.length < minTextLength) { | |
textarea.setCustomValidity('Please enter at least ' + minTextLength + ' characters.'); | |
} else { | |
textarea.setCustomValidity(''); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In case need a tutorial to add the code: https://youtu.be/RRhmWHDpZ0I