DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Jquery Validation Not Clearing Errors Example
// jquery validation example not clearing error messages
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#command").validate({
errorPlacement: function(label, element) {
//$(element).prev(".error").replaceWith("");
label.insertBefore( element );
},
rules: {
"profileBean.loginEmail": {
required: true,
minlength: 5,
email:true
},
"password": {
required:true,
minlength:5
},
"passconfirm":{
required:true,
minlength:5,
equalTo:"#password"
}
},
messages:{
"profileBean.loginEmail":{
required:"Email must be supplied",
minlength:"specify at least 5 characters",
}
}
});
});
</script>
</head>
<body>
<table >
<form id="command" name="registerForm" action="www.cnn.com" method="POST">
<tr><td align="center"></td></tr>
<tr>
<td ><span class="spanlabel">Email Address</span><br />
<input id="profileBean.loginEmail" name="profileBean.loginEmail" type="text" value=""/></td>
</tr>
<tr>
<td ><span class="spanlabel">Password</span><br />
<input id="password" name="profileBean.password" type="password" value=""/></td>
</tr>
<tr>
<td ><span class="spanlabel">Re-enter password</span><br />
<input type="password" id="passconfirm" name="passconfirm" /></td>
</tr>
<tr>
<td >
<input type="submit" name="submit" /></td>
</tr>
</form>
</table>
</body>
</html>





