The following is the test of my pro-tested mobile phone number format demo, the need for small partners to take away the ~
<! DOCTYPE html>
<meta charset= "Utf-8"/>
<title></title>
<!--here for your own jquery address--
<script src= "Js/jquery.min.js" type= "Text/javascript" charset= "Utf-8" ></script>
<style type= "Text/css" >
#phone_msg {
color:red;
font-size:12px;
}
</style>
<body>
<input type= "text" id= "PhoneNumber"/>
<button> Click Jump </button>
<p id= "Phone_msg" ></p>
<script type= "Text/javascript" >
$ ("button"). Click (function () {
Get input Box
var phoneinput = $ ("#phonenumber");
Get Input Box Contents
var PhoneNumber = $ ("#phonenumber"). Val ();
Verify Phone number format
function Isponeavailable (phoneinput) {
var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
if (!myreg.test (PhoneNumber)) {
$ ("#phone_msg"). HTML ("Please enter the correct phone number format");
return false;
} else {
$ ("#phone_msg"). HTML ("Validation is successful, this bar does not show");
return true;
}
}
Isponeavailable ();
})
</script>
</body>
Mobile phone number verification Regular expression +demo (pro-Test complete)