jQuery Validation PlugIn : Forcing Validation on empty Field
I have a form with tho fields. The first one is required.
step 1. When I submit the form, I get the error as expected. step 2. Then if I enter开发者_运维百科 a text on the field, the error text is clear, which is perfect.
My only concern is that if I remove the text entered, leaving the field empty, the validation don't fire up!
Is there a way to force validation on empty fields? or at least use the callback function that is used on step 2? I want to perform some tasks when a validation fails.
The goal is to change the class of a label every time the validation fails.
I used
onkeyup : function(element){
if ($(element).valid()==0) {
$(element).prev().removeClass();
$(element).prev().addClass("status_form_warning");
}
精彩评论