views:

20

answers:

2

I've got the selector below:

$("#<%=GridView1.ClientID%> td:nth-child(5)").hover('doSomething)

Which is selecting the 5th td that is generated by a GridView. This is working fine.

My problem is I have paging enabled, and its also selecting the < Prev 1 2 3 Next > at the bottom, any ideas how to exclude this?

+1  A: 

modify your selector to select the 5th <td>s in all rows except for the last one, assuming the paging is inside the last <tr>

try:

$("#<%=GridView1.ClientID%> tr:not(:last-child) td:nth-child(5)").hover(doSomething)

Moin Zaman
+1  A: 

If you check the HTML output you will see the paging elements are in a nested table, so just be a little more defined with your selector:

$("#<%=GridView1.ClientID%> > tbody > tr > td:nth-child(5)").hover('doSomething)
Jamie Carruthers