Answers for "validate phone number javascript"

9

js regex validate phone number

My regex of choice is:

/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im
Valid formats:

(123) 456-7890
(123)456-7890
123-456-7890
123.456.7890
1234567890
+31636363634
075-63546725
Posted by: Guest on February-07-2020
1

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>
Posted by: Guest on January-24-2021
0

js validate phone number

/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im
Posted by: Guest on May-26-2021
0

js phone number validation

^(?!.*911.*\d{4})((\+?1[\/ ]?)?(?![\(\. -]?555.*)\( ?[2-9][0-9]{2} ?\) ?|(\+?1[\.\/ -])?[2-9][0-9]{2}[\.\/ -]?)(?!555.?01..)([2-9][0-9]{2})[\.\/ -]?([0-9]{4})$
Posted by: Guest on September-28-2021

Code answers related to "validate phone number javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language