This article describes how to use jquery to verify your email address and mobile phone number. The specific implementation ideas and Code are as follows:
The Code is as follows:
// Jquery verification email
Function checkSubmitEmail (){
If ($ ("# email"). val () = ""){
// $ ("# ConfirmMsg" pai.html ("the email address cannot be blank! ");
Alert ("email cannot be blank! ")
$ ("# Email"). focus ();
Return false;
}
If (! $ ("# Email "). val (). match (/^ \ w + (-\ w +) | (\. \ w +) * \ @ [A-Za-z0-9] + ((\. |-) [A-Za-z0-9] + )*\. [A-Za-z0-9] + $ /)){
Alert ("Incorrect email format ");
// $ ("# ConfirmMsg" ).html ("Incorrect email format! Enter again! ");
$ ("# Email"). focus ();
Return false;
}
Return true;
}
// Jquery verifies the mobile phone number
Function checkSubmitMobil (){
If ($ ("# mobile"). val () = ""){
Alert ("the mobile phone number cannot be blank! ");
// $ ("# MoileMsg" developer.html ("the mobile phone number cannot be blank! ");
$ ("# Mobile"). focus ();
Return false;
}
If (! $ ("# Mobile "). val (). match (/^ (13 [0-9] {1}) | 159 | 153) + \ d {8}) $ /)){
Alert ("Incorrect mobile phone number format! ");
// $ ("# MoileMsg" ).html ("Incorrect mobile phone number format! Enter again! ");
$ ("# Mobile"). focus ();
Return false;
}
Return true;
}