1

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.

2 Answers 2

6

I would suggest wrapping your checkboxes in labels

Here's a working demo

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

Sign up to request clarification or add additional context in comments.

1 Comment

@gdoron drag mouse down side of checkboxes , will highlight the labels..then he wants checkboxes to flip checked property
1

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

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

5 Comments

@Spiros. Couldn't see there selected option. What're you trying to do exactly, put it in the filter?
If you go to the events tab (below the example): $( ".selector" ).selectable({ selected: function(event, ui) { ... } });
@Spiros. Can you please create a JSFiddle. It is really hard to understand what is the problem you're facing.
@gdoron.. had troubles too, figured it out, didn't think would work but turned into interesting UI
Thanks. I was going to send you this link - jsfiddle.net/spairus/7CGpW/20 - explaining what I need, but @charlietfl already got the answer. +1 for trying :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.