Limit Characters For Text Fields - jQuery Char Count

File Size: 2.65 KB
Views Total: 1204
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Limit Characters For Text Fields - jQuery Char Count

Char Count is a tiny jQuery plugin that limits the number of characters allowed to type in text fields and displays how many characters are left.

In addition, the plugin also has the ability to change the styles of the character count when you're about to exceed the max character limit. 

How to use it:

1. Load the JavaScript jquery.charCountPlugin.js after loading the latest jQuery library.

<script src="" 
<script src="jquery.charCountPlugin.js"></script>

2. Specify the maximum allowed characters in the data-maxlen attribute.

<h2>Input Field</h2>
<input data-charcount="true" 

<textarea data-charcount="true" 

3. Initialize the plugin on the text fields and done.

(function ($) {
  $(document).ready(function () {

4. Customize the character counter by overriding the default settings as shown below:

  errFontColor: 'red',
  okFontColor: 'green',
  FontWeight: 'bold',
  NumOfCharOfAlert: 20,
  isAlwaysOn: true

This awesome jQuery plugin is developed by ZopCoder. For more Advanced Usages, please check the demo page or visit the official website.