Javascript Ajax jQuery Html PHP Example Quiz New MORE
Need a Website Or Web Application Or Any Help.Contact Us: +91 9437911966 (Whatsapp) Note: Paid Service

jQuery form validation Email, Mobile Number


In this example we will discuss how to validate jQuery form Email, Mobile Number, name etc.

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Makes "field" required and an email address.</title>
	<link rel="stylesheet" href="https://jqueryvalidation.org/files/demo/site-demos.css">
	<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
	<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
	<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
</head>
<body>
	<form id="myform">
		<label for="name">Required, email: </label><br>
		<input class="left" id="name" name="name"><br>
		<label for="email">Required, email: </label><br>
		<input class="left" id="email" name="email"><br>
		<label for="phone">Required, Phone: </label><br>
		<input class="right" id="mobile" name="mobile">
		<br/>
		<input type="submit" value="Validate!">
	</form>

	<script>
	jQuery.validator.setDefaults({
	  debug: true,
	  success: "valid"
	});
	$( "#myform" ).validate({
	  rules: {
		name: {
		   required: true,
			minlength: 2
		},
		email: {
		  required: true,
		  email: true
		},
		mobile: {
		  required: true,
		  number: true,
		  minlength: 10,
		  maxlength: 10
		}
	  }
	});
	</script>
</body>
</html>   
Run it Yourself »