Today, We want to share with you mobile number validation in html w3schools.In this post we will show you input type for mobile number in html, hear for 10 digit mobile number validation in javascript w3schools we will give you demo and example for implement.In this post, we will learn about How To Allow Only 10 Digit Mobile Number Validation Using Javascript With Jquery with an example.
html code for phone number format
Phone numbers from India are 10 digits long, and start with 7, 8, or 9.
For example:
7845845454
9898585985
8989554741
These phone numbers are valid, but
2121212121
5545454545
3545648584
are invalid.
Minimum digits 10
Maximum digits 10
number starts with 7,8,9
^[789]\d{9,9}$
html phone number input
Example 1:
The <input type="tel"> defines a field for entering a telephone number. Note: Browsers that do not support "tel" fall back to being a standard "text" input. Tip: Always add the <label> tag for best accessibility Examples! Define a field for entering a telephone number: <label for="phone">Enter your phone number:</label> <input type="tel" id="phone" name="phone" pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}">
HTML5 phone number validation with pattern
Example 2: /(7|8|9)\d{9}/
<input type="text" pattern="[789][0-9]{9}">
Example 3:
<input type="text" name="Phone Number" pattern="[7-9]{1}[0-9]{9}" title="Phone number with 7-9 and remaing 9 digit with 0-9">
I hope you get an idea about html input pattern numbers only.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.
I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I’m a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.