textarea limit code injquery
Best example for limit of textarea and find count
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>jQuery test</title>
<style>
body {font-family:arial;}
</style>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
//runs once page is loaded and ready to be manipulated
$(document).ready(function(){
var maxNum=100;
$('#status').bind({
keypress : function() {
var inputText = $(this).val();
var numChar = inputText.length;
var charRemain = maxNum-numChar;
if (numChar <= maxNum) {
$('.counter').text(charRemain);
}else if (numChar > maxNum){
event.preventDefault();
}
}
});
});
</script>
</head>
<body>
<textarea cols="50" rows="5" id="status" maxlength='100'></textarea>
<br>
<div class="counter"></div>
</body>
</html>