Auto Tab Form Fields using JavaScript:
This a simple sample code for auto tab form fields using javascript. It works in conjunction with the "maxlength" attribute of HTML, triggered whenever the user's input reaches the maxlength's value.
Code:
Try this demo:
Enter your input:
This a simple sample code for auto tab form fields using javascript. It works in conjunction with the "maxlength" attribute of HTML, triggered whenever the user's input reaches the maxlength's value.
Code:
<script type="text/javascript"> /* Auto tabbing script http://codingcluster.blogspot.in/ */ function autoTab(current,next){ if (current.getAttribute&¤t.value.length==current.getAttribute("maxlength")) next.focus() } </script> <b>Enter your input:</b> <form name="fromAutoTab"> <input type="text" name="first" size="4" onkeyup="autoTab(this, document.fromAutoTab.second)" maxlength="3" /> <input type="text" name="second" size="4" onkeyup="autoTab(this, document.fromAutoTab.third)" maxlength="3" /> <input type="text" name="third" size="5" maxlength="4" /> </form>
Enter your input:
5 comments:
Can you make it work for iPad Safari?
Thank you so much it working fine
when i use it in cshtml, it is throwing error.
when i use it in cshtml, it is not working. how to use this script in @html.editfor in mvc3.
it's not working :(
Post a Comment
Share your thoughts here...