How to change focus of textbox when it reaches to maxlength?
how to change focus of textbox when it reaches to maxlength? using java script
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Robbinson86 reputationPosted Dec 26, 2013, 9:13 PM EST
Below JQuery code will help you to perform the same. it will focus to next available input control when it reaches to maxlength of current control.
jQuery("form input[type=text]").on('input',function () {
if(jQuery(this).val().length == jQuery(this).attr('maxlength')) {
jQuery(this).next("input").focus();
}
});
Also, alternatively you can use available plugin i.e. Jquery auto tab. Below link will give you an idea on the same.
http://www.mathachew.com/sandbox/jquery-autotab/
Hope, this will help you out. Feel free to contact in case of query.
Please don't forget to mark as answer if this post helps you.