HTML CODE
<!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 >= 500) { val.value = val.value.substring(0, 500); } else { $('#charNum').text(500 - len+ " Characters Left"); } }; </script> </head> <body> <textarea id="field" onkeyup="countChar(this)"></textarea> <div id="charNum">500 Characters left</div> </body> </html>
DEMO
Check this link http://jsfiddle.net/vetri/p2h976e8/3/