Sav2907,
и?
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
</script>
<style type="text/css">
label.error {
position: absolute;
margin-left: 12px;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://jqueryvalidation.org/files/dist/jquery.validate.js"></script>
<script>
$.validator.addMethod("minlenghtphone", function (value, element) {
return value.replace(/\D+/g, '').length > 10;
},
" Маловато циферок будет!");
$.validator.addMethod("requiredphone", function (value, element) {
return value.replace(/\D+/g, '').length > 1;
},
" Заполните это поле!!!");
$.validator.addMethod("minlenghtname", function (value, element) {
return value.replace(/\D+/g, '').length > 15;
},
" Маловато циферок будет!");
$.validator.addMethod("requiredname", function (value, element) {
return value.replace(/\D+/g, '').length > 1;
},
" Заполните это поле!!!");
$(function () {
$("#commentForm").validate({
rules: {
phone: {
requiredphone: true,
minlenghtphone: true
},
name: {
requiredname: true,
minlenghtname: true
}
}
})
});
</script>
</head>
<body>
<center>
<form class="cmxform" id="commentForm" method="get" action="">
<p><input class="left" id="phone" name="phone" maxlength="11"></p>
<p><input class="left" id="name" name="name" maxlength="14"></p>
<p><input class="submit" type="submit" value="Submit"/></p>
</form>
</center>
</body>
</html>