简体   繁体   English

取消选择/选中D3类中的所有复选框

[英]Deselect/Select all checkboxes in Class for D3

function deselectAll(){
d3.selectAll('input').property('checked', false);
drawUpdate();
}

I'm trying to deselect all checkboxes listed under a certain class because I have two seperate classes for two sets of checkboxes. 我试图取消选择某个类下列出的所有复选框,因为我为两组复选框设置了两个单独的类。 Is it possible to do that with D3? 用D3可以做到吗? I tried replacing 'input' with '.checkboxClass'. 我尝试将“输入”替换为“ .checkboxClass”。

Of course you can do that: 当然,您可以这样做:

d3.selectAll('.someclass').property('checked', false);

Test it here: jsfiddle 在这里测试: jsfiddle

What is the problem, when you try to select the checkboxes by their class? 当您尝试按类别选择复选框时,出了什么问题?

如果要取消选中复选框,请使用:

d3.selectAll('input').trigger('click')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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