jquery validation rules

后端 未结 3 1243
闹比i
闹比i 2020-12-19 15:22
  1. My phone validation depends on a checkbox (no, don\'t contact me via phone). If this is checked, then I will not need run the phone validation. I googled around and fo
3条回答
  •  醉酒成梦
    2020-12-19 15:45

    try something like this:

    "#phone1": {
       number: true,
       minlength:3,
       required: function(element){
          return ($('#pri_noPhone_wrapper input:checked').val() == 'True');
       }
    }
    

    The HTML (after looking at this I forgot to add the wrapper HTML)

    
    Phone:
    
    
    

提交回复
热议问题