mspir
mspir

Reputation: 1734

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.

Upvotes: 1

Views: 4331

Answers (2)

charlietfl
charlietfl

Reputation: 171669

I would suggest wrapping your checkboxes in labels

Here's a working demo

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

Upvotes: 6

gdoron
gdoron

Reputation: 150263

I never heard of selectable plugin, but to get the checked checkboxes:

$('input[type="checkbox"]:checked')

Upvotes: 1

Related Questions