Search code examples
jqueryselectablejquery-ui-selectable

Jquery select multiple checkboxes with .selectable


I am a little bit confused with Jquery .selectable. What I need to do, is to make an area that contains checkboxes to be selectable (I'm ok up to here) and then check which of the selected checkboxes are already checked (so I can uncheck them), of check them if they are not.

$("#calContainer").selectable({
    filter: 'checkbox',
    selected: function(event, ui) {
        // need code for:
        // for every checkbox in selected area thats is checked, uncheck
        // for every checkbox in selected area thats is not checked, check
    }
});

Any help is appreciated. Thanks.


Solution

  • I would suggest wrapping your checkboxes in labels

    Here's a working demo

    http://jsfiddle.net/skeR4/1/