views:

552

answers:

3

Hi all, I've got a table which I'm pulling in from an external website, but I need to be able to hide the first 2 columns, add a class to the 3rd column, add a class to the 6th row and delete the 7th row. I've managed to do the columns, but I'm having problems with the rows..

I'm using the following code to hide the first 2 columns and add a class to the third:

<script type="text/javascript" language="javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
    jQuery('table.ladder td:nth-col(1),table.ladder th:nth-col(1),table.ladder td:nth-col(2),table.ladder th:nth-col(2)').hide();
    jQuery('table.ladder td:nth-col(3),table.ladder th:nth-col(3)').addClass('leftColumn');
});
</script>

Could someone please help me add a class to the 6th TR and then remove the 7th TR?

Cheers

Leanne

+2  A: 

Add a class to the 6th tr.

jQuery('table.ladder tr:eq(5)').addClass('yourNewClass');

Remove the 7th tr.

jQuery('table.ladder tr:eq(6)').remove();
Patrick McElhaney
+2  A: 

Use the eq() method, then next().

jQuery('table.ladder tr').eq(5).addClass('newClass')
                         .next('tr').remove();
tvanfosson
A: 

@SoulieBaby: You forgot to mention, that nth-col selector is a plugin. Can be found on: http://www.bramstein.com/projects/column/.

Sorry for posting a comment as an answer, can't comment yet.

Artur Gajowy