在jquery.validate中检查字符串 [英] To check string in jquery.validate
本文介绍了在jquery.validate中检查字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
用于密码验证,我正在使用equalTo:"#password"
是否可以通过在jquery.validate中输入equalTo:"string to check"
来检查某些刺痛
for password validation i am using equalTo:"#password"
Whether it is possible to check some sting by giving as equalTo:"string to check"
in jquery.validate
推荐答案
equalTo
only takes a selector here, but you can make a custom method for the check you want:
jQuery.validator.addMethod("equals", function(value, element, param) {
return this.optional(element) || value === param;
}, jQuery.format("You must enter {0}"));
然后您可以使用具有相同名称的规则:
Then you can use the a rule with the same name:
equals:"string to check"
这篇关于在jquery.validate中检查字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文