mobile number validation in javascript

<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
<form method="post" action="">
	Email:<input type="text"  id="number" onkeyup="validation()">
	</form>
</body>
<script type="text/javascript">
	function validation(){
	var number=document.getElementById("number").value;///get id with value 
	var numberpattern=/^\+?([0-9]{2})\)?[-. ]?([0-9]{4})[-. ]?([0-9]{4})$/;////Regular expression
	if(numberpattern.test(number))
	   {
		document.getElementById("number").style.backgroundColor='yellow';
       }
    else
      {
    	document.getElementById("number").style.backgroundColor='red'; 
      }
	}

</script>
</html>

3.33
3
Aland 100 points

                                    /^\d{10}$/

3.33 (3 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
phone number automatic validation javascript mobile number validation js validation for mobile number js Mobile number validation iby js type for phone number validation in javascript mobile number validation in javascript with country code us phone number validation in javascript phone number javascript validation js mobile phone validation validation js by mobile number phone number validation in java script mobile phone validation in javascript india mobile number validation in javascript example in js of a phone number validation phone number validation using js validate mobile number js phone number validation with javascript validation phone numbers javascript number input for mobile number verification in javascript mobile number validation for all numbers in js mobile number validation in js how to validate mobile number in javascript in form phone number validation using javascript validation code for mobile number in javascript validation phone number javascript india phone number validation in javascript javascript valid mobile number mobile number validation in javascript starting with 7 8 9 how to validate an mobile number in javascript js mobile number validation Simple phone number validation in JavaScript validation for mobile number in javascript javascript validate mobile number mobile number validation in oninput js html js validation for ten number mobile number uk mobile number validation javascript validation in javascript phone number javascript function for mobile number validation phone number validation js program in javascript for validation phone number us mobile number validation javascript mobile number validation javascript javascript mobile number validation js format phone number based on country code validate mobile number in javascript how we check mobile number in validation in html using javascript validation for indian mobile number in javascript validate mobile number using javascript javascript phone number validation js validate mobile number how to validate mobile number in javascript mobile number validation in javascript starting with 7,8,9 package to check if string is a phone number jjs javascript verify phonenumber javascript check if value is phonenumber js validation for mobile number javascript input validation phone number create a pattern to validation phone number in javascript phone number validation in typescript phone no validation in javascript 10 digit mobile number validation in javascript validate phone number in javascript javascript validate phone number js validate phone number phone number for this country check in javascript validation validate telephone in JS mobile number validation with + sign and numeric html valid phone number check mobile number validation in jquery email or mobile phone number validation javascript hide country code mobile number js javascript universal mobile number validation mobile no validation in javascript phone number validation javascript either 628 or start with 8 phone number validation javascript phone number validation in javascript Write JavaScript codes to validate your phone number using reg-ex. validate phone number javascript how to validate a valide phone number in javascript js phone no validetion mobile number validation in javascript
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source