I've been building up my validation using the jquery validation plugin
but I can't work out how to get a failed validation to default the
focus to the first invalid input rather than to the last selected
input.

If there is no input field selected, when I submit then a failed
validation will focus the cursor on the first field but if the cursor
was left in a field and submitted then the focus stays there (if it's
invalid) rather than jump to the first invalid input.  From what I've
read and seen, this is the expected behaviour but not what I want.

Is there a way I can get the first invalid field and set the focus to
that?

A demo of what I have built up so far can be seen at
https://webdev2.otago.ac.nz/oihrn2009/

All my jquery validation can be found in
https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js

Reply via email to