更新时间:2023-01-31 19:31:18
更新:使用prop代替attr
UPDATED: Using prop instead of attr
<input type="checkbox" name="vehicle" id="vehicleChkBox" value="FALSE"/>
$('#vehicleChkBox').change(function(){
cb = $(this);
cb.val(cb.prop('checked'));
});
过期日期:
这是 jsfiddle
<input type="checkbox" name="vehicle" id="vehicleChkBox" value="FALSE" />
$('#vehicleChkBox').change(function(){
if($(this).attr('checked')){
$(this).val('TRUE');
}else{
$(this).val('FALSE');
}
});