使用jquery.validation equalTo(other)来确保"Sunday"是输入值 [英] Using jquery.validation equalTo( other ) to ensure "Sunday" is the inputted value
问题描述
RE: http://docs.jquery.com/Plugins/Validation
我正在设置一个简单的联系表单,并希望使用测验"作为简单的SPAM保护.
I am setting up a simple contact form and want to use a "quiz" as a simple SPAM protection.
因此,我要问的问题是星期六之后是哪一天?".
I am therefore asking the question, "What day comes after Saturday?".
为了能够继续提交表单,我需要弄清楚如何使用"equalTo"方法来检查用户是否在继续之前输入了"Sunday".
To be able to proceed with form submission, I need to work out how to use the "equalTo" method to check if "Sunday" has been inputted by the user before proceeding.
有人可以帮我吗?我不确定该怎么办.我已经在该输入字段上设置了class ="required",但是不确定我还需要添加哪些其他类才能使所有这些正常工作?
Can anyone help me out with this? I'm not sure what to do. I already have the class="required" set on that input field, but not sure what other class I need to add to get this all working?
推荐答案
http: //docs.jquery.com/Plugins/Validation/Methods/equalTo#other
$(".selector").validate({
rules: {
userResponse: {
required: true,
equalTo: 'Sunday'
}
}
});
这篇关于使用jquery.validation equalTo(other)来确保"Sunday"是输入值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!