Last active
August 29, 2015 14:12
-
-
Save lyhapple/014c6a88916b261b6b7d to your computer and use it in GitHub Desktop.
使用jquery validate插件动态为表单的某些字段添加或移除验证
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add | |
$( "#myinput" ).rules( "add", { | |
required: true, | |
minlength: 2, | |
messages: { | |
required: "Required input", | |
minlength: jQuery.format("Please, at least {0} characters are necessary") | |
} | |
}); | |
//remove all | |
$( "#myinput" ).rules( "remove" ); | |
//remove one rule | |
$( "#myinput" ).rules( "remove", "min max" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment