After DOM Load in body

$.validator.addMethod("bd_phone",function(phone){
  var reg = /(^(\+88|0088)?(01){1}[56789]{1}(\d){8})$/;
    if(reg.test(phone)){
        return true;
    }
    return false;
},"");

if($(document.body).find('.minor').length){
    $("#publicReg").validate({
        rules: {
            birth_date: "required",
            district: "required",
            gender: "required",
            police_station: "required",
            full_name_bangla: "required",
            village_ward: "required",
            full_name_english: "required",
            post_code: "required",
            father_name: "required",
            mother_name: "required",
            occupation: "required",
            per_district: "required",
            mobile: {
              required:true,
              bd_phone:true
            },
            per_police_station: "required",
            per_village_ward: "required",
            per_post_code: "required"
        }
    });
}

Comments

Popular posts from this blog

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine