JQuery Plugin Multiple-Select - 如何询问是否在没有侦听器的情况下检查 selectAll
JQuery Plugin Multiple-Select - How-to ask if selectAll is checked without listeners
我在一个 HTML 站点上有两个 Multiple-Select 插件来自
http://wenzhixin.net.cn/p/multiple-select/docs/
我想问 Checkbox SelectAll 是否在不使用侦听器(即设置变量)的情况下被选中,因为我在另一个上下文中:
HTML-代码是这样的:
<table>
<tr>
<td>Tailoring Groups:</td>
<td><select id="cbTailoringGroups" multiple="multiple"></select></td>
</tr>
<tr>
<td>Keypoint responsibility:</td>
<td><select id="cbRoles" multiple="multiple"></select></td>
</tr>
</table>
我已经尝试过这段代码,但它没有像预期的那样工作...
if (!$("#cbTailoringGroups > input[data-name='selectAll']").is(':checked')) {}
根据 chrome 开发人员工具,问题可能是生成的代码如下所示:
询问复选框 "Select All" 是否被选中的正确方法是什么?顺便说一句:我在 HTML 站点上有两个实例,所以我不能简单地请求:
$("input[data-name='selectAll']").is(":checked");
function isAllChecked(parentId)
{
return $("#" + parentId +" ~ div.ms-parent div.ms-drop ul li input[data-name='selectAll']").is(':checked');
}
console.log(isAllChecked('cbTailoringGroups'));
console.log(isAllChecked('cbRoles'));
我在一个 HTML 站点上有两个 Multiple-Select 插件来自 http://wenzhixin.net.cn/p/multiple-select/docs/
我想问 Checkbox SelectAll 是否在不使用侦听器(即设置变量)的情况下被选中,因为我在另一个上下文中:
HTML-代码是这样的:
<table>
<tr>
<td>Tailoring Groups:</td>
<td><select id="cbTailoringGroups" multiple="multiple"></select></td>
</tr>
<tr>
<td>Keypoint responsibility:</td>
<td><select id="cbRoles" multiple="multiple"></select></td>
</tr>
</table>
我已经尝试过这段代码,但它没有像预期的那样工作...
if (!$("#cbTailoringGroups > input[data-name='selectAll']").is(':checked')) {}
根据 chrome 开发人员工具,问题可能是生成的代码如下所示:
询问复选框 "Select All" 是否被选中的正确方法是什么?顺便说一句:我在 HTML 站点上有两个实例,所以我不能简单地请求:
$("input[data-name='selectAll']").is(":checked");
function isAllChecked(parentId)
{
return $("#" + parentId +" ~ div.ms-parent div.ms-drop ul li input[data-name='selectAll']").is(':checked');
}
console.log(isAllChecked('cbTailoringGroups'));
console.log(isAllChecked('cbRoles'));