我在带有禁用按钮的表单上有两件事情的数组列表。我需要使用jQuery来检查选中了哪个值,如果选中了某个值,请重新启用“提交”按钮。
模型:
private List<String> billTypeOptions;
控制器:
List<String> billTypeList = new ArrayList<String>();
billTypeList.add("Direct Bill");
billTypeList.add("Agency Bill");
model.addAttribute("billTypeList", billTypeList);
ams360Policy.setBillTypeOptions(billTypeList);
HTML:
<td id="billTypeCell">
<div th:each="billType : ${billTypeList}">
<input class="bto" type="checkbox" th:field="*{ams360Policies[__${stat.index}__].billTypeOptions}" th:value="${billType}" value="off"/>
<label th:text="${billType}" id="billTypeLabel"></label>
</div>
</td>
我已经尝试过了:
if($('.bto').is(":checked"){
$('#send').attr("disabled",false);
}
我也尝试过
if ($('.bto').val() == 'Direct Bill")
if ($('.bto').value == 'Direct Bill")