Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('textarea').on('keypress change blur',function(e)
- {
- var tval = $('textarea').val(),
- tlength = tval.length,
- set = 250, // max chars number
- remain = parseInt(set-tlength);
- $('.remain').text(remain);
- if (remain<=0 && e.which!==0 && e.charCode!==0)
- $('textarea').val((tval).substring(0,tlength-1))
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement