Jquery Validate form validation, dynamically add and delete validation rules

It has recently been busy with maintenance Jquery mall, use the form validation Validate, and thought it was interesting to look at the record.

 

1  // dynamically add validation rule 
2 $ ( "# invoice_send_region_id") the rules ( "the Add." , {
 . 3      required: to true ,
 . 4      min: 1 ,
 . 5      messages: {
 . 6          required: '$ lang.region_required {}' ,
 . 7          min: '{} $ lang.region_required'
 . 8      }
 . 9  });
 10  
. 11  // dynamically remove validation rule 
12 is $ ( "# invoice_send_region_id") the rules ( "remove");.

 

Guess you like

Origin www.cnblogs.com/ykCoder/p/11738438.html