Skip to content

Instantly share code, notes, and snippets.

@imshuffling
Created January 24, 2019 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imshuffling/b905ce3f3c2782532d59880a09ae793f to your computer and use it in GitHub Desktop.
Save imshuffling/b905ce3f3c2782532d59880a09ae793f to your computer and use it in GitHub Desktop.
jQuery, focus() to next input field, based on input maxlength attribute
$(document).ready(function(){
$(".giftcardCodeChecker .numbers input").on('input', function () {
if($(this).val().length == $(this).attr('maxlength')) {
$(this).next().focus();
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment