Simple Char Counter For Inputs and Textareas
File Size: | 2.79KB |
---|---|
Views Total: | 1231 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |

A simple jQuery plugin that attachs a character counter to your form input or textarea elements to limit the maximum length of user input.
Basic Usage:
1. Include jQuery and charactercounter.js
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <script src="jquery.character.counter.min.js"></script>
2. Markup. Set the maximum length via data-max-length
attribute
<textarea cols="50" rows="20" id="tester" data-max-length="400"></textarea>
3. You can style your inputs and textareas with class of "character_counter" and "invalid". The plugin adds a paragraph element with class of "character_counter". The count is updated on the keyup event and if the input exceeds the maximum length specified a class of "invalid" is added to the paragraph element.
This awesome jQuery plugin is developed by efexen. For more Advanced Usages, please check the demo page or visit the official website.