<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-1.5.js"></script> <script> function countChar(val) { var len = val.value.length; if (len >= 200) { val.value = val.value.substring(0, 200); } else { $('#charNum').text(200 - len); } }; </script> </head> <body> <textarea id="field" onkeyup="countChar(this)"></textarea> <div id="charNum"></div> </body> </html>
Saturday, 23 January 2016
Count characters in textarea
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment