jQuery – count characters in textarea and text inputs

So how to count characters of textarea or text input in jQuery? Let’s keep things simple.

jQuery.maxlength

The jQuery.maxlength is a lightweight jQuery character counter and countdown for inputs and textareas. Easy to use.

Count characters in JavaScript / jQuery
Count characters in JavaScript / jQuery

Basic usage

HTML:

<input type="text" maxlength="50"/>

JS:

$("input").maxlength();

Few lines and ready!

More advanced example available here:

http://jsfiddle.net/pioul/ysC7L

Homepage:

http://pioul.fr/jquery-maxlength

GitHub:

https://github.com/pioul/jQuery.Maxlength

See also:

– related topic on Stackoverflow:

http://stackoverflow.com/questions/5371089/count-characters-in-textarea

In this topic we will find a lot of solutions, both using jQuery, and in pure JavaScript.

3…2…1… Enjoy!

Share:Share on Facebook1Share on Google+0Tweet about this on TwitterShare on LinkedIn1Pin on Pinterest1