$ ("#memberLevelForm"). Validate ({rules: {"Phone": { Required:true, Ismobile:true }}, Submithandler:function () {}, Messages: {"Phone": {required: "Please enter the phone number!" ", Ismoblie:true}}); }); Mobile number verification JQuery.validator.addMethod ("IsMobile", function (value, Element) {var length = Value.lengt H var mobile =/^ (13[0-9]{9}) | (18[0-9]{9}) | (14[0-9]{9}) | (17[0-9]{9}) | (15[0-9]{9}) $/; return this.optional (Element) | | (length = = && Mobile.test (value)); }, "Please fill in the correctWrite mobile phone number "); ID Number Verification JQuery.validator.addMethod ("Isidcardno", function (value, Element) {return this.optional ( Element) | | Isidcardno (value); }, "Please enter your ID number correctly"); ID card validation introduced method function Isidcardno (num) { var Factorarr = new Array (7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1); var paritybit = new Array ("1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"); var vararray= new Array (); VAR intvalue; var lngproduct = 0; VAR intcheckdigit; var intstrlen = num.length; var idnumber= num; //initialize if ((intstrlen! =) && (Intstrlen!=18)) { & nbsp return false; } //Check Andset value for (i = 0;i<Intstrlen; i++) {Vararray[i]= Idnumber.charat (i); if ((Vararray[i] < ' 0 ' | | vararray[i]>' 9 ') && (i! =)) {return false; } else if (i< -) {Vararray[i]= Vararray[i]* Factorarr[i]; }} if (Intstrlen== {//check date var date8= idnumber.substring (6,14); if (IsDate8 (Date8)== false) {return false; }//Calculate the sum of the products for (i= 0;i <; i++) {lngproduct= Lngproduct+ vararray[i]; }//Calculate the check digit intcheckdigit= Paritybit[lngproduct% 11]; Check last digit if (vararray[17]!= intcheckdigit){return false; }} else{//length is a//check date var date6= idnumber.substring (6,12); if (IsDate6 (DATE6)== false) {return false; }} return true; } function IsDate6 (sdate) {if (!/^[0-9]{6}$/.test (sdate)) {return false; } var year,month, day; year=sdate.substring (0,4); Month=sdate.substring (4,6); if (year< 1700 | | year>2500) Returnfalse if (month<1| | month>return false return True} function IsDate8 (sdate) {if (!/^[0 -9]{8}$/.test (sdate)) {return false; } var year,month, day; Year =sdate.substring (0, 4); Month =sdate.substring (4, 6); Day =sdate.substring (6, 8); var iamonthdays = [ +, +, +, +, +, +, +, +,-30,31] if (year<1700| | year>2500) return False if ((year%4 = = 0) && (year% 100 = 0)) | | (Year% 400 = = 0)) IAMONTHDAYS[1] = 29; if (Month<1| | month>) return False if ( day<1| | Day>Iamonthdays[month-1]) return false return True}
Mobile Verification and ID verification