Skip to content

Instantly share code, notes, and snippets.

@inog
Last active March 22, 2018 09:18
Show Gist options
  • Save inog/8862158e400e04d4c3d5c1d4107001c7 to your computer and use it in GitHub Desktop.
Save inog/8862158e400e04d4c3d5c1d4107001c7 to your computer and use it in GitHub Desktop.
focus next input when maxlength is reached
var a = document.getElementById('form:tabView:kan1'),
b = document.getElementById('form:tabView:kan2'),
c = document.getElementById('form:tabView:jahr');
a.onkeyup = function() {
if (this.value.length === parseInt(this.attributes["maxlength"].value)) {
b.focus();
}
}
b.onkeyup = function() {
if (this.value.length === parseInt(this.attributes["maxlength"].value)) {
c.focus();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment