Advertisement
Guest User

Untitled

a guest
May 24th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. var delay = 0, offset = 20;
  2.  
  3. $('form').on('submit', function(e){
  4. scrollToFirstInvalid();
  5. });
  6.  
  7. function scrollToFirstInvalid(){
  8. $('html, body').animate({scrollTop: $('input:required:invalid').first().offset().top-offset, delay})
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement