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
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
RobbinsonPosted Dec 27, 2013, 2:13 AM
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.