my jquery loops through all tables
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();
};
Here is the jsfiddle http://www.jsfiddle.net/tommyd/Br42j/
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.cboxandinput:checkbox