1, form submission when the prompt box
$ ("#form1"). Validate ({
Submithandler:function (form) {
if (confirm) (' Confirm modification. ') = = True) {
Message ("Processing form ...");
Form.submit ();
}else{
Window.location.reload ()//Add this sentence to clear the contents of the form
}
}
});
2, verify the contents of the input box must be a combination of letters, numbers, and special characters, and the length can not be less than 8
JQuery.validator.addMethod ("Checkpassword",
function (value,element) {
if (value.length==0)
{
return true;
}
if (value.length!=0&&value.length<8) {
return false;
}
Return/^[-\da-za-z ' =\\\[\]; ',./~!@#$%^&* () _+|{}: "<>?" * (\d+[a-za-z]+[-' =\\\[\]; ',./~!@#$%^&* () _+|{}: "<>?] +)| (\d+[-' =\\\[\]; ',./~!@#$%^&* () _+|{}: "<>?] +[a-za-z]+) | ([a-za-z]+\d+[-' =\\\[\]; ',./~!@#$%^&* () _+|{}: "<>?] +)| ([a-za-z]+[-' =\\\[\]; ',./~!@#$%^&* () _+|{}: "<>?] +\d+) | ([-' =\\\[\]; ',./~!@#$%^&* () _+| {}: "<>?] +\d+[a-za-z]+) | ([-' =\\\[\]; ',./~!@#$%^&* () _+| {}: "<>?] +[a-za-z]+\d+)) [-\da-za-z ' =\\\[\]; ',./~!@#$%^&* () _+|{}: "<>?] *$/.test (value);
},
"Password at least 8 digits, need to include numbers, letters, special characters");
3, the contents of the input box must be a combination of characters and letters
JQuery.validator.addMethod ("Alnum", function (value, Element) {
return this.optional (Element) | | /^[a-za-z].*[0-9].*[a-za-z]| [a-za-z].*[0-9]| [0-9].*[a-za-z]| [0-9].*[a-za-z].*[0-9]+$/.test (value);
}, "must be a combination of letters and numbers");
4, not equal to the verification, the contents of two input boxes if not equal through
JQuery.validator.addMethod ("NotEqual", function (value, element, param) {
var target = $ (param). Unbind (". Validate-equalto"). Bind ("Blur.validate-equalto", function () {$ (Element). valid ();
var targetvalue=target.val ();
return!value==targetvalue;
}, "Can't Be with ... Same ");
Use: notequal: #login ID of the input box in which login is to be compared