Categories: JavaScript

Jquery Validation Example1

http://docs.jquery.com/Plugins/Validation
 
Same Example Try in above link with demo 
 
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
<style type="text/css">
* { font-family: Verdana; font-size: 96%; }
label { width: 10em; float: left; }
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
p { clear: both; }
.submit { margin-left: 12em; }
em { font-weight: bold; padding-right: 1em; vertical-align: top; }
</style>
<script>
$(document).ready(function(){
$("#commentForm").validate();
});
</script>

</head>
<body>


<form class="cmxform" id="commentForm" method="get" action-xhr="#">
<fieldset>
<legend>A simple comment form with submit validation and default messages</legend>
<p>
<label for="cname">Name</label>
<em>*</em><input id="cname" name="name" size="25" class="required" minlength="2" />
</p>
<p>
<label for="cemail">E-Mail</label>
<em>*</em><input id="cemail" name="email" size="25" class="required email" />
</p>
<p>
<label for="curl">URL</label>
<em>  </em><input id="curl" name="url" size="25" class="url" />
</p>
<p>
<label for="ccomment">Your comment</label>
<em>*</em><textarea id="ccomment" name="comment" cols="22" class="required"></textarea>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
</body>
</html>
Developer Diary

Share
Published by
Developer Diary
Tags: JQuery

Recent Posts

Top 10 ChatGPT Prompts to Learn Anything 10x Faster

Introduction Learning has been transformed by artificial intelligence, which provides resources that enable you to…

11 months ago

Discover the Ultimate Tool for Frontend Designers and Developers

Introduction Even experienced developers may find it difficult to create aesthetically pleasing and useful web…

11 months ago

Git Tag Cheat Sheet

Introduction Git tags are an essential feature of version control systems, offering a simple way…

1 year ago

Understanding Web Storage: Cookies, Local Storage

Introduction The methods that browsers employ to store data on a user's device are referred…

1 year ago

Setting up OpenVPN Access Server in Amazon VPC – AWS

Introduction A well-known open-source VPN technology, OpenVPN provides strong protection for both people and businesses.…

1 year ago

Enhance Error Tracking & Monitoring: Integrate Sentry with Node.js & Express.js

Introduction Integrating Sentry into a Node.js, Express.js, and MongoDB backend project significantly enhances error tracking…

1 year ago