Closed ghost closed 11 years ago
Can you give me an example?
You are trying to use this code or something similar?
$('#myCheckBox').attr('checked', true);
Yeah, you are very clever :)
I used that one but toggle button didn't react to the change.
How should I do?
Wingy
On Wed, Sep 12, 2012 at 7:31 PM, Mattia Larentis notifications@github.comwrote:
Can you give me an example?
You are trying to use this code or something similar?
$('#myCheckBox').attr('checked', true);
— Reply to this email directly or view it on GitHubhttps://github.com/nostalgiaz/bootstrap-toggle-buttons/issues/8#issuecomment-8502946.
The problem is that this code does not raise an event and then the toggle button does not change state.
$('#myCheckBox').attr('checked', true);
then you should use something like this
var $myCheckBox = $('#myCheckBox')
$myCheckBox.attr('checked', ! $myCheckBox.is(':checked')).trigger('change');
It doesn't seem that the bootstrap toggle button is matching whether the checkbox is checked or not.
Is this a deliberate design choice?
Eg. when the checkbox is checked the toggle button is showing OFF.