我必须使用 jquery validate 插件来验证这样的表单:
<form class="myform"
<select name="Input" id="input1">
<option value="DO0" opt_numAdults="2" opt_numChilds="0" >0</option>
<option value="DO1" opt_numAdults="2" opt_numChilds="0" >1</option>
<option value="DO2" opt_numAdults="2" opt_numChilds="0" >2</option>
<option value="DO3" opt_numAdults="2" opt_numChilds="0" >3</option>
<option value="DO4" opt_numAdults="2" opt_numChilds="0" >4</option>
<option value="DO5" opt_numAdults="2" opt_numChilds="0" >5</option>
</select>
<select name="Input" id="input2">
<option value="FP0" opt_numAdults="2" opt_numChilds="1" >0</option>
<option value="FP1" opt_numAdults="2" opt_numChilds="1" >1</option>
<option value="FP2" opt_numAdults="2" opt_numChilds="1" >2</option>
<option value="FP3" opt_numAdults="2" opt_numChilds="1" >3</option>
<option value="FP4" opt_numAdults="2" opt_numChilds="1" >4</option>
<option value="FP5" opt_numAdults="2" opt_numChilds="1" >5</option>
</select>
<button type="submit" id="mybutton">Go</button>
</form>
如果他没有选择这两个字段中的至少一个,我需要停止用户。我正在使用此代码,但它不起作用...
$bt('.myform').submit(function(){
if($('#input1').val() == "" || $bt('#input2').val() == ""){
alert("Complete all fields!");
return false;
}
});
});
有任何想法吗?