Created
December 11, 2009 19:52
-
-
Save anselmobattisti/254462 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
textboxes = $("input, select, textarea"); | |
if ($.browser.mozilla) { | |
$(textboxes).keypress (checkForEnter); | |
} else { | |
$(textboxes).keydown (checkForEnter); | |
} | |
function checkForEnter (event) { | |
console.log(this); | |
if (event.keyCode == 13) { | |
currentBoxNumber = textboxes.index(this); | |
if (textboxes[currentBoxNumber + 1] != null) { | |
nextBox = textboxes[currentBoxNumber + 1] | |
nextBox.focus(); | |
event.preventDefault(); | |
return false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment