Im just trying to customize where I put the error messages generated by jQuery validation. I have the following code:
$('document').ready(function(){
$('form').validate({
rules: {
a: {required:true, minlength:2}
},
messages: {
a: {required: "enter your name!"}
},
errorPlacement: function(error, element) {
if(element.attr('name' == 'a')){
error.appendTo($('#restErrorDate'));
}
},
debug:true
});
$('#a').blur(function(){
$("form").validate().element("#a");
});
});
here is the html:
<div>
<form action="#">
<input type="text" name="a" id="a">
</form>
</div>
<div id="restErrorDate" class="restErrorDate" style="border:1px solid blue;"></div>
For some reason it is not working. Thanks so much in advance for your help...this little thing has been keeping me working for a long time. Here is the jsfiddle: