0
是否有可能使用jquery validation設置Bootstrap樣式的div下拉選項與選項/選擇?我無法在此頁面上將標籤更改爲選項/選擇。還有多個下拉菜單。div下拉的jQuery錯誤驗證
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span data-bind="label">Month</span><span class="caret"></span>
<label class="error" for="dobMonth" generated="true"></label>
</button>
<ul name="dobMonth" id="dobMonth" class="dropdown-menu">
<li><a href="#">January</a></li>
<li><a href="#">February</a></li>
<li><a href="#">March</a></li>
<li><a href="#">April</a></li>
</ul>
</div>
$(document).ready(function() {
$("#form").validate({
rules: {
"dobMonth": {
required: true
}
},
messages: {
"dobMonth": {
required: "Enter the month you were born"
}
},
submitHandler: function (form) {
alert('valid form submitted');
return false;
}
});
});
你應該檢查這裏給出的答案:[Jquery Validate](http://stackoverflow.com/questions/12467682/jquery-validate-dropdown-list) –