remote: URL Use ajax for verification. By default, the currently verified value will be submitted to the remote address. If you need to submit other values, you can use the data option
remote: "check-email.php" remote: { url: "check-email. php", //Background processing program type: "post", //Data sending method dataType: "json", //Accept data format data: { //Data to be transferred username: function() { return $("#username").val(); } } }
Remote address can only be output" true" or "false", no other output is allowed addMethod: name, method, message Custom validation method // Two bytes of Chinese characters jQuery.validator.addMethod("byteRangeLength ", function(value, element, param) { var length = value.length; for(var i = 0; i < value.length; i ){ if(value.charCodeAt( i) > 127){ length ; } } return this.optional(element) || ( length >= param[0] && length <= param[1] ); }, $.validator.format("Please ensure that the entered value is between {0}-{1} bytes (one Chinese character counts as 2 bytes)")); / / Zip code validation jQuery.validator.addMethod("isZipCode", function(value, element) { var tel = /^[0-9]{6}$/; return this.optional (element) || (tel.test(value)); }, "Please fill in your zip code correctly"); Verification of radio, checkbox, and select Required of radio means that one must be selected
required in checkbox means it must be selected
The minlength of the checkbox represents the minimum number that must be selected, maxlength represents the maximum number of selections, and rangelength:[2,3] represents the range of the number of selections