jQuery使用.selectable选择多个复选框 [英] Jquery select multiple checkboxes with .selectable

查看:169
本文介绍了jQuery使用.selectable选择多个复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Jquery .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
    }
});

感谢您的帮助.谢谢.

推荐答案

我建议将复选框包装在标签中

I would suggest wrapping your checkboxes in labels

这是一个正在运行的演示

Here's a working demo

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

这篇关于jQuery使用.selectable选择多个复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆