Jquery scroll to first instance of a class (.error) for jquerytools validator
- by Tommy Arnold
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?