Countdown remaining text characters in an HTML text input with jQuery

Using this simple Javascript with jQuery code snippet, we can count down the number of Text characters remaining based on a limit we set. This is very similar to how Twitters status input shows how many text characters remain as you type in text.

For example, if we type in 20 text characters (including spaces) of 140 allowed, this will show 120 remaining. If we go over the 140 characters, then the counter div will be updates with a negative number and add the CSS class .overlimit which will change the counter text color to RED in my example below to show that it is in the negative range.

jQuery Code

The HTML Text Input/Textarea and CSS

Example on JSFiddle