When form is validated, how to SCROLL to the first error instead of jumping?

后端 未结 6 777
一向
一向 2021-01-30 01:34

I\'ve seen many questions with variations on this theme, but I\'m looking for the straightforward solution:

HTML form, jQuery validation, multiple fields are required. W

6条回答
  •  青春惊慌失措
    2021-01-30 01:57

      $("#create-form").validate({ // Set Focus on first invalid input
        focusInvalid: false,
        invalidHandler: function() {
          $(this).find(":input.error:first").focus();
          }
      });
    

提交回复
热议问题