Created
October 22, 2014 19:15
-
-
Save briansteeleca/3d35d9bd7112feda3809 to your computer and use it in GitHub Desktop.
Accessible form error focus solution with jQuery Validation (from Katie) #jquery #validation #accessibility #errors #katie
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
// http://stackoverflow.com/questions/1218118/overriding-a-function-within-the-jquery-validation-plugin | |
$("form#user-register").validate({ | |
// focus will normally go to the last error | |
// but this will make it go to the first! | |
invalidHandler: function(form, validator){ | |
$(validator.invalidElements()[0]).focus(); | |
}, | |
focusInvalid:false | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment