Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
JQuery Maxchars Plugin
WhatsApp
febin JS
12y
6.1
k
0
0
25
Blog
Had a glance on JQuery's new feature, thought of sharing this with you - "Maxchar" plugin. I found this plugin very useful since we are using similar kind of sinareos in our projects, I think this might be helpful for you guys also.
As there are many senarios where we have to restrict characters in our UI controls, so usually we go for a UI property maxLength or some custom jQuery methods for doing like that as we had done in our Projects Mylo & others. But now JQuery had released Maxchar plugin so that its very simple to use.
This plugin is freely available in net:-
http://www.unleashed-technologies.com/projects/maxchars/jquery.maxchars.0.0.zip
How to use this plugin is elaborated by some examples below :-
Suppose in our page we have a textArea [id="description"], for that we have to limit the character upto 400.
$('#discription').maxchars(400);
The basic syantax of this is
$('#elementID').maxchars(options);
We can also define similar options by using this single code ie for example
$('#discription').maxchars({
maxchars: 400,
showExtraChars: true,
messageHolder: $('div.messagebox') });
Here
maxchars:- Its the maximum number of characters that can be given inside a particular control , if this is blank it will take the html maxlength property value by default.
showExtraChars:- Its a boolean value , if set to true we can type extra characters inside the control. but if false it will automatically delete the extra characters what we have entered into the control.
messageHolder:- It will hold the control where we can show the remaining characters.
JQuery Maxchars Plugin
Up Next
jQuery migrate to new version plugin
Ebook Download
View all
Frontend Developer Interview Questions and Answers
Read by 940 people
Download Now!
Learn
View all
Membership not found