Jquery scroll to first instance of a class (.error) for jquerytools validator

Posted by Tommy Arnold on Stack Overflow See other posts from Stack Overflow or by Tommy Arnold
Published on 2011-03-13T16:05:29Z Indexed on 2011/03/13 16:10 UTC
Read the original article Hit count: 148

Filed under:
|
|
|

I am using jquerytools validator on a clients website but the page using this plugin is very long so I would like to add a custom handler using the folowing code.

$("#form").bind("onFail", function(e, errors)  {

    // we are only doing stuff when the form is submitted
    if (e.originalEvent.type == 'submit') {

    $(".errormsg").html("Please scroll up and fix the highlighted errors.");
        //alert("Please fix the highlighted errors to continue");
    }
});

How would I get it to scroll up to the first instance of .error?

Can you recommend any plugins for this?

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery