尝试这个。它允许多个选择字段相互验证。
<form id="esq">
<select required="required" name="sqa" id="sqa">
<option value="1" selected="selected">What was your childhood nickname?</option>
<option value="2">In what city did you meet your spouse/significant other?</option>
<option value="3">What is the name of your favorite childhood friend?</option>
</select>
<select required="required" name="sqb" id="sqb">
<option value="1">What was your childhood nickname?</option>
<option value="2" selected="selected">In what city did you meet your spouse/significant other?</option>
<option value="3">What is the name of your favorite childhood friend?</option>
</select>
<br />
<select required="required" name="sqc" id="sqc">
<option value="1">What was your childhood nickname?</option>
<option value="2">In what city did you meet your spouse/significant other?</option>
<option value="3" selected="selected">What is the name of your favorite childhood friend?</option>
</select>
<br />
$(document).ready(function () {
$.validator.addMethod("notEqualTo", function (value, element, param) {
var pArray = param.split(",");
var rs = true;
$.each(pArray, function (i, v) {
if (rs == true) {
rs = value != $("select[name=" + v + "]").val();
};
});
return rs;
}, "You must choose three separate questions.");
$("#esq").validate({
rules: {
sqa: {
notEqualTo: "sqb,sqc"
},
sqb: {
notEqualTo: "sqa,sqc"
},
sqc: {
notEqualTo: "sqa,sqb"
}
}
});
});
[http://jsfiddle.net/mrmupton/F6pfB/][1]