ansman/validate.js

Scroll to first error

Closed this issue · 2 comments

How can we scroll to the first error the form finds? If the form is big and error is at top, it's not visible.

i'm using this inside handleFormSubmit()

    if(errors){
      $('html, body').animate({
        scrollTop: $('.your-error-class').offset().top -100
      }, 1000);
    } 

Thank you very much, this is exactly what I needed!