Created
April 4, 2013 21:23
-
-
Save Badgerati/5314494 to your computer and use it in GitHub Desktop.
This JavaScript will automatically focus another control depending on the length of the current control's content. This should be called in a control's onkeyup event.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function move(current, next, previous, length) { | |
if (next != null && current.value.length >= length) { | |
document.getElementById(next).focus(); | |
} | |
else if (previous != null && current.value.length <= 0) { | |
document.getElementById(previous).focus(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment