I have a very extensive form and I would like to click submit and the field is in error, that the page can scroll (jQuery) to this field so that the person knows exactly what has error. I started like this:
$("#sdEmpresa").removeClass("hidden").css("border", "1px dashed red");
So I managed to streamline this:
if(empresa == ""){
// callback method use this space how you like
var body = $("html, body");
body.animate({scrollTop:0}, 1500, function(){
$("#sdEmpresa").removeClass("hidden").css("border", "1px dashed red");
});
}
Here it goes back to the body, how to go back to #sdEmpresa
?