I want to use jquery to limit the number of characters in an editable div (or form input).
相关问题
- Views base64 encoded blob in HTML with PHP
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
If you want to make use of JQuery you can write something yourself or just use an existing plugin such as this one.
But I agree with dku.rajkumar... What is wrong with using the
maxlength
attribute?If you're the biggest JQuery fan ever though and desperately want to set a
maxlength
to all of the input fields at once do something like:Just keep in mind though that this method (the JQuery one) will not work for people who have (for any reason whatsoever) JavaScript disabled. While the
maxlength
attribute of theinput
tag works for everybody on all browsers.