判断checkBox标签某一个选项是否被选中

时间:2021-07-06 09:01:27

<c:if test="${canDeductible eq true}">
是否用积分抵扣:<input type="checkbox" name="deductible" id = "deductible">
本次可用${canUsePoints}积分抵扣${changeCash}元
</c:if>
<form id="shopForm" method="post" action="<c:url value='/cart/${cartMall.id}/2/sumbit.htm'/>"><input type="hidden" name="cartJson" id="cartShopJson"><input type="hidden" value = "false" name="isDeductible" id = "isDeductible"></form>
$('#deductible').on('change',function(){if($("#deductible").is(':checked')){       //当前为选中状态          $("#isDeductible").attr("value", true);    }else{        //当前为不选中状态        $("#isDeductible").attr("value", false);    }});