In this Post,i shall say how you may allow only 10 numbers in textbox using jquery.we exactly allow only 10 digit number validation in jquery. guest may only enter 10 numbers in textbox using jquery for country code with phone number or mobile validation.
I will give you simple step by step all the example of how to restrict or required guest to type 10 digit numbers in input HTML element.we may do phone number validation in javascript it that thing multiple way.We shall show different format of 10 digit mobile number validation using javascript with jquery also you can check my prev Article email validation in javascript
10 digit mobile number validation using javascript with jquery
The validating mobile number is best and an important point while validating an HTML form. In this Article we have all about the how to validate a mobile number (in different format) using HTML/JavaScript/jQuery :
One it using pattern attribute in html and email validation in javascript another is max length and jquery keypress event. Therefor you may exactly display both example. You may display also source code bellow. You may use anyone as you want.
so, we validate a mobile number of 10 digits with no any type of the comma, no any spaces char, no any punctuation with there shall be Not allowded + sign in front the Mobile number. Simply how to check mobile number validation shall remove all non-digits with permit only mobile numbers with 10 digits. Here is the regular expression for 10 digit mobile number.
10 digit mobile number validation using javascript with jquery
index.html
JavaScript form validation - checking non-empty - www.pakainfo.com Input an Phone No.[xxxxxxxxxx] and Submit
10 digit mobile number validation using HTML 5
here easy example for phone number validation in javascript
How to allow only 10 digit number validation in Jquery? - pakainfo.com
mobile number validation in jquery
How to allow only 10 digit number validation in Jquery? - pakainfo.com
jquery mobile number validation
index.html
www.pakainfo.com Jquery Form Validation : Validate Phone Numbers
phone number validation in javascript onblur
Validation for 10 digit mobile number with focus or onblur input field on invalid
//HTML Code//jQuery Code
phone number validation with country code in javascript
Example of the Validate an international phone number with country code
JavaScript form validation - checking non-empty - www.pakainfo.com Input an Phone No.[+xx-xxxx-xxxx, +xx.xxxx.xxxx, +xx xxxx xxxx] and Submit
mobile number validation in php
simply You can preg_match() to validate 10-digit mobile numbers:
preg_match('/^[0-9]{10}+$/', $mobile)
To call it in a simple PHP function:
function validate_mobile($mobile) { return preg_match('/^[0-9]{10}+$/', $mobile); }
How to validate phone number in PHP?
index.php
function validate_phone_number($phonevalidate) { $filtered_phone_number = filter_var($phonevalidate, FILTER_SANITIZE_NUMBER_INT); $phone_to_check = str_replace("-", "", $filtered_phone_number); if (strlen($phone_to_check) < 10 || strlen($phone_to_check) > 14) { return false; } else { return true; } } $phonevalidate = "+91-888-555-9999"; if (validate_phone_number($phonevalidate) == true) { echo "Good Luck, Your Phone number is valid"; } else { echo "sorry dear your Invalid phone number"; }
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about phone/Mobile number validation in html.
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.