Closed ecarter202 closed 8 years ago
I have the same request. I'm using a javascript function to select or un-select a group of checkboxes.
<input type="checkbox" name="participant" class="js-switch case" value="45464" id="45464">
$("#selectall").click(function () {
$('.case').attr('checked', this.checked);
});
The Switchery class 'js-switch' appears to intercept / interfere with the code above. Any advice is appreciated.
Try using prop instead of attr: http://api.jquery.com/prop/
Check the answer from @svetlinyotov here: https://github.com/abpetkov/switchery/issues/92 it worked for me
This plugin is all but useless without this functionality.
Somewhere towards the end of https://github.com/abpetkov/switchery/issues/27 you'll find a working demo of how to handle checked state dynamically. In short - you check the native input and fire a change
event.
Closing this issue, since it's a duplicate.
It would be nice to be able to say, if not switched on, switch on.