Mobile phone number verification Regular expression +demo (pro-Test complete)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.