I am currently facing an issue with displaying error messages on my "contact me" form. Although I have successfully implemented validation, I am struggling to comprehend how the errorPlacement
function should be utilized. Could someone provide me with a practical example based on the code snippet I have included below?
<fieldset>
<input placeholder="Your name" name="contact_name" id="contact_name" class="contact_input" type="text" tabindex="1" required autofocus>
</fieldset>
<fieldset>
<input placeholder="Your email address" name="contact_mail" id="contact_mail" class="contact_input" type="email" tabindex="2" required>
</fieldset>
<fieldset>
<input placeholder="Company name (optional)" name="contact_firmname" id="contact_firmname" class="contact_input" type="text" tabindex="3">
</fieldset>
$(document).ready(function(){
$('body').on('keyup','#contact_me',function(){
$('#contact_me').validate({
rules: {
contact_name: {
required: true,
remote: location.protocol + '//' + location.host+'/ajax_contact.php'
},
contact_mail: {
required: true,
remote: location.protocol + '//' + location.host+'/ajax_contact.php'
},
contact_firmname: {
},
},
errorPlacement: function(){
return false;
},
submitHandler: function (form) {
return false;
}
});
});
});