As soon as I insert errorPlacement:
function, it breaks the code. No validation happens on click of submit. can someone help please.
If I remove this function, validation works fine.
Imports:-
<script type="text/javascript" src="/MyApp/js/jquery.js"></script>
<script type="text/javascript" src="/MyApp/js/jquery.validate.min.js"></script>
Script:-
$(document).ready(function(){
$("#post-an-ad").validate({
rules:{
articleTitle:{
required: true,
minlength: 5
},
dateRequested:{
required: true,
date: true
},
articleLocation:{
required: true,
minlength: 8
},
'user.agent': "required",
'user.firstName': "required",
'user.emailId':{
required: true,
email: true
},
'user.phone':{
required: true,
minlength: 8,
number: true
}
},
errorPlacement: function(error, element) {
alert("This alert is not popping");
},
submitHandler: function(form){
// doing nothing on a submit.
return false;
}
});
});