Http://www.w3cschool.cc/jquery/jquery-plugin-validate.html This document is quite comprehensive!
Practice:
Some of the more complex checks, such as regular calibration, can be done by JQuery.validate.addMethod () Http://jqueryvalidation.org/jQuery.validator.addMethod
To implement, after adding, you can add a validation rule in the rules by Jquery.validate ()
JQuery.validator.addMethod ("Numorletter", function (value, Element) {return this.optional (element) | |/^[0-9| A-z|a-z]+$/.test (value);}, "Please enter a number or letter"); $ ("#inputForm"). Validate ({ rules: { //Name of the form to validate Operationcode: { //custom validation rules Numorletter:true , //ajax checksum verifies whether the user's lost content exists in the database through the background service. Background service only needs to return True or False, Boolean type, String type can be remote:{ // Here by get method, the parameter is placed after the URL, just start? After writing operationcode=, after the request is sent, the URL becomes?operationcode=&operationcode=value //So it's removed. URL: "${ctx}/ Operation/operation/validatecode? "+ $ (" #operationCode "). Val (), type: "GET", datatype: "JSON" //post mode, you can use //data:{paramname:value,...} Pass Parameters } } }, messages:{ operationcode:{ //Specify error messages here Remote: "The specified number already exists" &Nbsp; } }});
Official website http://jqueryvalidation.org/
Reference Document http://jqueryvalidation.org/
JQuery Validate Custom CHECKSUM ajax checksum