Skip to content

Instantly share code, notes, and snippets.

@juanbrujo
Created October 8, 2013 01:05
Show Gist options
  • Save juanbrujo/6877808 to your computer and use it in GitHub Desktop.
Save juanbrujo/6877808 to your computer and use it in GitHub Desktop.
Simple character countdown
function characterCountdown() {
var characterLeft = 140 - jQuery('textarea').val().length;
jQuery('.message').text(characterLeft + ' characters left.');
}
$(function() {
characterCountdown();
$('textarea').change(characterCountdown);
$('textarea').keyup(characterCountdown);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment