jQuery Plugin To Restrict The Number of Characters In Text Fields - CharLimit

File Size: 77.1 KB
Views Total: 854
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Restrict The Number of Characters In Text Fields - CharLimit

CharLimit is a lightweight and customizable jQuery plugin which limits the number of characters that can be entered or copied into text fields. Supports both textarea and input field. The plugin also provides a functionality to display the remaining characters that auto update when typing.

How to use it:

1. Make sure to load the jQuery CharLimit plugin after loading jQuery JavaScript library.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="charlimit.js"></script>

2. Call the function with default options. By default, the plugin permits only 10 characters being entered into the text field.

$('.charlimit').charlimit({});

3. Available options with default values.

// number of input character
limit : 10 (),

// class added in the input box or textarea
'this_class':'mzrlimit'

// add red color to input box when count 0
// 0 or 1
'color': 0,

// make disable when input limit achieved value
// 0 or 1
'disable':0,

// show hide remaining char count
// 0 or 1
'statusshow':1,

// class of status text
'statusclass':'status',

// example : div , span . status will be shown in this element
'type':'div',

// 'before' or 'after'
'position':'after',

// text after remaining char count . example : 10 char left / 4 letter more ..
'text':'char left'

About author:

Author: rothy1248

Website: https://github.com/rothy1248/charlimit


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