I am trying to get the jQuery validation working on a webpage I am creating. I have about 6 different fieldsets that contain the page\'s details. I am using this as I am hid
I can't see anything in the docos that can do that. The only other way i can think of doing it is.
$('#field1, #field2, #field3').blur(function(){
validator.validate()
});
Thia code will not fire validation onkeyup, but on blur "lost focus" the validation will be fire, as will once the user starts to edit the field, validation message will disappear. find more interesting other customization on this ref: https://jqueryvalidation.org/category/plugin/
$('#frm').validate({
onkeyup: false,
focusCleanup: true
});
Diver Dan was right
$('form').validate({
onfocusout: function (element) {
$(element).valid();
},
rules: {
name: 'required',
from: 'required'
},
messages: {
name: 'Please enter your firstname',
from: 'Please enter where are you from'
}
});
Just set on onkeyup = false
$('form').validate({
rules: {
name: 'required',
from: 'required'
},
onkeyup: false
,
messages: {
name: 'Please enter your firstname',
from: 'Please enter where are you from'
}
});
try:
onkeyup: function (element, event) {
$(element).valid();
// your code
}
You can also use the element call of the validator.
$('form').validate({
onfocusout: function(element) {
this.element(element);
},
rules: {
name: 'required',
from: 'required'
},
messages: {
name: 'Please enter your firstname',
from: 'Please enter where are you from'
}
});