jQuery Limit Characters Input: Limit the number of characters of text form inputs

Recommend this page to a friend!
     
  Info   Example   View files Files   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 37 All time: 518 This week: 2Up
Version License JavaScript version Categories
maxchars 1.0BSD License5jQuery, Forms
Description 

Author

This is a jQuery plugin that can be used to limit the number of characters of text form inputs.

It can traverse all form inputs that exist in a Web page with the maxChars attributes and retrieves the number that is set on those attributes.

The plugin can add text span element next each input to display the number of characters that the user can type before the input value character length reaches the limit specified by the maxChars attribute.

Picture of Gianluca Zanferrari
  Performance   Level  
Name: Gianluca Zanferrari <contact>
Classes: 6 packages by
Country: The Netherlands The Netherlands
Age: 58
All time rank: 81 in The Netherlands The Netherlands
Week rank: 6 Up2 in The Netherlands The Netherlands Down
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

Example

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Title of the document</title> </head> <body> Name:<br> <!-- the property maxChars="25" limits the number of allowed chars to 25 --> <input id="Name" maxChars="25" style="width:250px"> <br>Address:<br> <!-- the property maxChars="40" limits the number of allowed chars to 40 --> <input id="Address" maxChars="40" style="width:250px"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="./maxChars.js"></script> <script> var obj = new maxChars(); </script> </body> </html>

  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file maxchars.html Example example file
Plain text file maxchars.js Class class itself

 Version Control Unique User Downloads Download Rankings  
 0%
Total:37
This week:0
All time:518
This week:2Up