Desired Output


Mobile Number Validation using JavaScript











Source Code




<html>
<head>
	<script language="javascript">
		function validate()
		{
			var mob=document.getElementById("t1").value;
			if(mob=="")
			{
				document.getElementById("s1").innerHTML="Please Enter the Mobile Number";
			}
			else if(isNaN(mob))
			{
				document.getElementById("s1").innerHTML="Please Enter Only Digits";
			}
			else if(mob.length!=10)
			{
				document.getElementById("s1").innerHTML="Please Enter 10 Digits Number";
			}
			else if(!(mob.startsWith("9")||mob.startsWith("8")||mob.startsWith("7")))
			{
				document.getElementById("s1").innerHTML="Please Enter valid Mobile Number";
			}
			else 
			{
				document.getElementById("s1").innerHTML="Ok, You Entered a Valid Mobile Number";
			}
		}
	</script>
</head>
<body>
<center>
<h1>Mobile Number Validation using JavaScript</h1>
<br/><br/>
<label>Enter Mobile Number </label> <input type="text" id="t1" placeholder="Enter 10 Digit Mobile Number"/>
<br/><br/>
<span id="s1" style="color:red"></span>
<br/><br/>
<input type="button" value="Validate" onclick="validate()"/>
</center>
</body>
</html>


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz