隐藏表格中的所有复选框不起作用 [英] hide all checkboxes in table not working
本文介绍了隐藏表格中的所有复选框不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的jquery遍历所有表
my jquery loops through all tables
我想使用class ="cbox"和当前表中的所有复选框隐藏所有范围 但是我的代码无法正常工作.
I would like to hide all spans with the class="cbox" and all checkboxes within the current table but my code isnt working.
var table_ids = new Array();
$('.sizetable')
.each(function(e){
tableid = $(this).attr('id');
//$msg = tableid;
//alert($msg); This alerts the correct id
$( "#" + tableid + " .cbox").hide();
$( "#" + tableid + " input:checkbox").hide();
};
这是jsfiddle http://www.jsfiddle.net/tommyd/Br42j/
Here is the jsfiddle http://www.jsfiddle.net/tommyd/Br42j/
推荐答案
只需使用$('.sizetable .cbox, .sizetable input:checkbox').hide()
.按ID选择速度更快,但是您已经在按类选择以获取ID,因此不妨直接从那里隐藏所有.cbox
和input:checkbox
Just use $('.sizetable .cbox, .sizetable input:checkbox').hide()
. Selecting by ID is faster, but you're already selecting by class to get the ID, might as well just go from there and hide all .cbox
and input:checkbox
这篇关于隐藏表格中的所有复选框不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文