Javascripts > Javascript Forms > Jump To Next Field When Maxlength Reached
Script Title: Jump To Next Field When Maxlength Reached
Description: Move to the next field when the maximum length has been reached.
Example: Available
This script automatically jumps to the next input field when the current field's maxlength has been reached.
Copy the following code into your <HEAD></HEAD> tags.<script type="text/javascript"> function toUnicode(elmnt,content) { if (content.length==elmnt.maxLength) { next=elmnt.tabIndex if (next<document.maxform.elements.length) { document.maxform.elements[next].focus() } } } </script>
Copy the following code between the <BODY></BODY> tags of your html page.<p>This script automatically jumps to the next input field when the current field's maxlength has been reached.</p> <form name="maxform"> <input size="3" tabindex="1" maxlength="3" onkeyup="toUnicode(this,this.value)"> <input size="3" tabindex="2" maxlength="3" onkeyup="toUnicode(this,this.value)"> <input size="3" tabindex="3" maxlength="3" onkeyup="toUnicode(this,this.value)"> </form>
Enter your name and email address to have this script sent right to your Inbox for later viewing. First Name Last Name Email