JavaScript

maxlength_countdown() - a useful jQuery plugin for showing characters left


1st of May 2011

If people find this useful I might turn it into a proper jQuery plugin and publish it.

Without further ado; here's the demo

What it does is that for all input fields that have a maxlength="nnn" it shows a counter to the right that increases in opacity as it reaches the maximum. You can generally start it like this:

 $('input[maxlength]').maxlength_countdown();

Since the plugin "hard codes" the count down expression in English you can override it easily like this:

 $('input[name="message"]').maxlength_countdown(function (count, max) {
    return count + " (max: " + max + ")";
 });

What do you think? Is it useful? Does it make sense?



Comment

Show all 10 comments
 

Commenting is currently disabled in Mobile version