I have a ASP.NET MVC application and I want to focus the first field in error. On submit, if the last field has error and user tries to submit the form, the focus is going to th
No need to use each here and loop over all errors. You can just set the focus to first element with error class input-validation-error like:
first
input-validation-error
$('.input-validation-error:first').focus();