简体   繁体   中英

jQuery Unobtrusive Validation Trigger

Does someone know what is the event that triggers unobtrusive valdation: onchange; onleave, etc.?

I want to trigger the event with

$(element).trigger('event_name') 

rather than

$(element).validate() 

because of nulls validation rules.

Isn't that the submission of validated form? Of course if the given element is a form element.

Below quote from the plugin site ( http://jqueryvalidation.org/reference/ )

Validation event

By default, forms are validated on submit, triggered by the user clicking the submit button or pressing enter when a form input is focused (option onsubmit). In addition, once a field was highlighted as being invalid, it is validated whenever the user types something in the field (option onkeyup). When the user enters something invalid into a valid field, it is also validated when the field loses focus (option onblur).

The goal of these interactions is to provide feedback as early as possible, whilst avoiding user annoyance. Displaying error messages before the user had the chance to even type something is not helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM