vsenetak,
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<script src="http://jqueryvalidation.org/files/lib/jquery-1.11.1.js"></script>
<script src="http://jqueryvalidation.org/files/dist/jquery.validate.js"></script>
<script>
$.validator.setDefaults({
submitHandler: function () {
alert("Всё ок!");
}
});
$.validator.addMethod("newEmail", function (value, element) {
return /^[a-z0-9_-]{3,}@[a-z0-9-]+\.[a-z]{2,6}$/i.test( value )
},
"Вот это фигня")
$(function () {
$("#commentForm").validate({
rules: {
email: {
required: true,
newEmail: true
}
}
})
});
</script>
</head>
<body>
<form class="cmxform" id="commentForm" method="get" action="">
<fieldset>
<p><input class="left" id="email" name="email"></p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
</body>
</html>