Copyright © 2012 Tom Coote. All Rights Reserved. Powered by WordPress themed by bavotasan.com.
I built this whilst watching Britain’s Got Talent yesterday. I wasn’t enjoying the show to much. It’s a simple jQuery plugin that you can attach to textarea or input elements which will limit the amount of characters that are allowed for the input and also show a counter in the top right corner to indicate the character count.
All you need is the CSS and JavaScript on your page then attach it to something like this;
$(textarea).charCount(100);
Visit the demo page to have a go or download the source.


July 23, 2011 at 8:32 pm
extending….
$.fn.charCount = function(limit,message) { …..
if(message == undefined){
countBox.attr(‘title’, ‘Number of characters left.’);
}else{
countBox.attr(‘title’, message);
}
when you call..
$(‘input’).charCount(90,’whatever…..’);