By default, the jQuery validation plugin is attaching validation handlers for focusin
, focusout
and keyup
events.
1 of our validations is making a (synchronous) request to retrieve some data. I want to have that validation triggered only when the form is being submitted and not while the user is typing.
I know this can be modified for the whole form, but that's not what I'm looking for.
Is there a way to dynamically disable keyup
validation for 1 element?
Update 1:
I forgot to mention that I'm using unobtrusive validation. So I don't think the answer of @Mario Johnathan is not an option.
Update 2:
I tried the following things ($element
is the element on which I want to change the validation behavior):
$element.validate({focusout: false, keyup: false});
$element.keyup(function() { return false; });
$element.off('keyup');
$element.unbind('keyup');