Tryit Editor v1.4

<html> <head> <script type="text/javascript"> function checkLen(x,y) { if (y.length==x.maxLength) { var next=x.tabIndex; if (next<document.getElementById("myForm").length) { document.getElementById("myForm").elements[next].focus(); } } } </script> </head> <body> <p>This script automatically jumps to the next field when a field's maxlength has been reached:</p> <form id="myForm"> <input size="3" tabindex="1" maxlength="3" onkeyup="checkLen(this,this.value)"> <input size="2" tabindex="2" maxlength="2" onkeyup="checkLen(this,this.value)"> <input size="3" tabindex="3" maxlength="3" onkeyup="checkLen(this,this.value)"> </form> </body> </html> | Your Result:
Edit the code above and click to see the result. | W3Schools.com - Try it yourself