I have a table and I am hiding some rows. I want to get the first td in all of the rows that are showing. I have the following statement
$("table.SimpleTable tbody tr:visible td:first-child");
this works in FireFox but not in IE any ideas?
I am running the code on a click event. The html that you have written is pretty much spot on but for the some reason unknown to me it is not working. I have found a work around though. (I am trying to get a comma delimited string of all values in the first td for the visible rows) Anyway the following work around gets the job done.
var notfirst = false;
var serials = "";
var tds = $("table.SimpleTable tbody tr:visible td:first-child");
for (var i = 0; i < tds.length; i++) {
var td = $(tds[i]);
if (td.is(":hidden"))
continue;
if (notfirst)
serials += ",";
else
notfirst = true;
serials += $.trim(td.text());
}
For some reason the :hidden tag works correctly but not the :visible in IE7
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With