bootstrap-checkbox
bootstrap-checkbox copied to clipboard
Changing checked state via javascript doesn't update the label
When changing the state of the checkbox using jquery script, the checkbox doesn't switch visually.
Look at this code
<input id="chk" type="checkbox") />
$('#chk').checkboxpicker();
$('#chk').prop('checked', false).trigger('change');
You will see the checkbox does not switch/toggle. Any idea how to fix it?
Cheers, Bit5
This is similar with issue #34.
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 :)