jQuery validation plugin not validating the fields onblur and onkeyup

Leave a Comment
If you want trigger jQuery validation onkeyup and onfocusout event, you must add following two jQuery validation methods to your validation script.
onkeyup: function(element) { $(element).valid(); },
onfocusout: function(element) { $(element).valid(); },
See the jQuery validation demo script.
$("#register").validate({
 submitHandler : function(form) {
  $('input:submit').attr('disabled', 'disabled');
  form.submit();
 },
 onfocusout: function (element) { $(element).valid();},
 onkeyup: function(element) { $(element).valid(); },
 rules : {
 },
 messages : {
 }
});
If above script not trigger jQuery validation onkeyup and onfocusout event. Trigger validation this way.
$(document).on('keyup blur click', '#formId input, #formId select, #formId textarea',function(){
 $(this).valid();
});
 
You may also refer following tutorials jquery validation.
PHP Quiz Application Using jQuery Ajax MySQL and Bootstrap

0 comments:

Post a comment