would like to show all errors on the right of a form when user makes input error. Example if user enters incorrect e-mail format. I have created the div but I am not able to correctly display the errors and remove them as soon as the user corrects the input. Till now I am just highlighting the textbox using the error id.
jquery:
var form = $("#contact_form");
var name = $("#name");
var nameInfo = $("#nameInfo");
var email = $("#email");
var emailInfo = $("#emailInfo");
var message = $("#message");
var messageInfo = $("#messageInfo");
var note = $("#note");
name.blur(validateName);
email.blur(validateEmail);
message.blur(validateMessage);
form.submit(function(){
if(validateName() & validateEmail() & validateMessage()){
return true;
}else{
return false;
}
});
function validateName(){
if(name.val().length < 5){
name.addClass("error");
return false;
}else{
name.removeClass("error");
return true;
}
}