Skip to content

Instantly share code, notes, and snippets.

@swape
Created May 21, 2013 10:24
Show Gist options
  • Save swape/5618835 to your computer and use it in GitHub Desktop.
Save swape/5618835 to your computer and use it in GitHub Desktop.
Limiting textarea content
var intMax = 140;
$('textarea').live('keydown blur' , function(){
var innerhtml = $(this).val();
if(innerhtml.length >= intMax ){
$(this).val( innerhtml.substring(0,intMax) );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment