That should work. With HTML that looks like this:
<table class='SimpleTable'> <tr style='display: none;'> <td>test1</td> </tr> <tr> <td>test2</td> </tr> <tr> <td>test3</td> </tr> <tr style='display: none;'> <td>test4</td> </tr> <tr> <td>test5</td> </tr> <tr> <td>test6</td> </tr> </table>
Performing this action:
$("table.SimpleTable tbody tr:visible td:first-child").css('color','red');
Makes red for me in Firefox, IE7. What does your HTML look like?
Here is what I tested above on
EDIT . It is very strange to me that you need to do what you are doing right now. You should be able to replace what you have right now:
var serials = []; $("table.SimpleTable tbody tr:visible td:first-child").each(function() { serials.push($.trim($(this).text())); }); var serials = serials.join(',');
If TDs are populated from the selector, they should only be visible. If you pick up hidden TDs in TV shows (which, I must emphasize, really shouldn't happen and is an error or an error sign somewhere), try this selector:
$("table.SimpleTable tbody tr:not(:hidden) td:first-child")
Paolo bergantino
source share