Skip to content

Instantly share code, notes, and snippets.

@justinhillsjohnson
Created November 28, 2012 22:22
Show Gist options
  • Save justinhillsjohnson/4165122 to your computer and use it in GitHub Desktop.
Save justinhillsjohnson/4165122 to your computer and use it in GitHub Desktop.
$franchiseForm.find('textarea').on('keyup', function(e) {
var $textarea = $(this);
var maxlength = $textarea.attr('data-maxlength');
var $countdown = $(this).parent().find('.charRemain');
if ($textarea.val().length > maxlength) {
$textarea.val($textarea.val().substring(0, maxlength));
} else {
$countdown.text(500 - $textarea.val().length);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment