When using the iCheck plug-in,
<label for="taoda" class="rad_chx_label" style="margin-right:20px;">
<input type="checkbox" id="pro1" name="isHaveDefaultProduct" value="1" />
<span style="margin-left:8px;">是</span>
</label>
<label for="remin" class="rad_chx_label">
<input type="checkbox" id="pro2" name="isHaveDefaultProduct" value="0" checked />
<span style="margin-left:8px;">否</span>
</label>
Simply define two labels
js as follows:
$(function(){
$('input[type=checkbox]').iCheck({ //注册复选框
checkboxClass: 'icheckbox_minimal-green',
});
$('input[type=checkbox]').on('ifChecked', function(event){
em=$(this);//alert(event.type + ' callback');
if(em.val()=="1"){
em.iCheck('uncheck');
}
});
});
will be found in
if(em.val()=="1"){
em.iCheck('uncheck');
}
em.iCheck('uncheck'); in does not work, that is, when you click the check box with value 1, it is immediately set to the unselected state after being selected,,,,
What should you do? What about writing?
If I remember correctly, there is a toggle, just use that one.