简体   繁体   中英

Selecting/Unselecting checkboxes by holding down the mouse button

I have a group of checkboxes that I would like to be checked or unchecked (if checked) when you select it with a mouse. I don't mean any ordinary type of select, I mean, select the checkboxes that are in the selected area of the mouse button being held down while you move over the checkboxes/labels.

I have trouble explaining this, so I made an image example.

So if I had a group of checkboxes/labels like this:

<input type="checkbox" id="i1"/><label for="i1">Jun 23 2012</label>
<input type="checkbox" id="i1"/><label for="i1">Jun 24 2012</label>
<input type="checkbox" id="i1"/><label for="i1">Jun 25 2012</label>
<input type="checkbox" id="i1"/><label for="i1">Jun 26 2012</label>

How do I do this?

例

I tried looking on google, but found nothing. Any assistance is appreciated. Thanks.

You better use

<select size=5 multiple>

Regards.

Try warpping the content in parent div.Then try:

$("#test").selectable({
filter:'label',
stop: function() {        
    $("input").attr('checked',false);
    $(".ui-selected input", this).each(function() {

        this.checked= true;

    });
}
});

Working Fiddle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM