Open bit5 opened 6 years ago
I found the problem. The problem is that I am using "trigger" to ensure the "change event" is raised. For quick workaround, I need to set the checked value to opposite value and then back to the actual value.
For example, the real value is FALSE, then do this:
$('#chk').prop('checked', true);
$('#chk').prop('checked', false);
As you can see, I've set the checked value to TRUE then set it back to FALSE.
I hope this help someone :)
It doesn´t work to me
When using this checkbox, the checked and unchecked is reversed.
Look at this code
<input id="chk" type="checkbox" checked) />
You will see that the "NO" has been selected. And when you use in the js it is totally wrong! The No will be "TRUE" and Yes will become "FALSE".
$('#chk').checkboxpicker();
$('#chk').change(function () { alert ($(this).is(":checked")); });
$('#chk').prop('checked', false).trigger('change');
Any idea how to fix it?
Cheers