I've looked at a couple of similar questions here but I still can's seem to get it to work. I'm trying to hide specific columns in a table that is being automatically generated on the page. I've managed to hide column header and the corresponding cells in the first row but I'm not sure how to make it work for the rest of the rows. What am I missing?
$(document).ready(function() {
$("table.lc_Table:eq(0) tr:eq(0) th").each(function(ind,ele) {
if( $.trim($(this).text()).match(/(Available|Order Limit)/gi) )
{
$("table.lc_Table:eq(0) tr th:eq("+ind+"), table.lc_Table:eq(0) tr td:eq("+ind+")").hide();
}
});
});
<table border="0" cellspacing="0" cellpadding="4" class="lc_Table">
<tr>
<th class="lc_Heading">
<p class="PaddedListHeadingsC">Ticket Class</p>
</th>
<th class="lc_Heading">
<p class="PaddedListHeadingsC">Available</p>
</th>
<th class="lc_Heading">
<p class="PaddedListHeadingsC">Order Limit</p>
</th>
<th class="lc_Heading">
<p class="PaddedListHeadingsC">Price</p>
</th>
</tr>
<tr class="lc_Row0">
<td class="lc_Cell">
<p>Attendee1</p>
</td>
<td align="right" class="lc_Cell">
<p>50</p>
</td>
<td align="right" class="lc_Cell">
<p>No Limit</p>
</td>
<td align="right" class="lc_Cell">
<p>$0.00</p>
</td>
</tr>
<tr class="lc_Row1">
<td class="lc_Cell">
<p>Attendee2</p>
</td>
<td align="right" class="lc_Cell">
<p>50</p>
</td>
<td align="right" class="lc_Cell">
<p>No Limit</p>
</td>
<td align="right" class="lc_Cell">
<p>$0.00</p>
</td>
</tr>