Side navigation
#7692 closed bug (invalid)
Opened December 03, 2010 01:49PM UTC
Closed December 03, 2010 02:52PM UTC
selector :gt does not work on table
| Reported by: | edwin74@hetnet.nl | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.6 |
| Component: | unfiled | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
when give a class to a <tr> and want to exclude each first d in a row the following code does only disabled the first td in the first row:
$j('.getform td:gt(0)')
<tr class="getform">
<td></td>
<td></td>
</tr>
<tr class="getform">//this first td is clickable but schould not be clickable
<td></td>
<td></td>
</tr>
This gies the desired result:
$j('.getform td:not(:first-child)')
Attachments (0)
Change History (1)
Changed December 03, 2010 02:52PM UTC by comment:1
| resolution: | → invalid |
|---|---|
| status: | new → closed |
Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case! After checking your report I came to the conclusion that this isn't a bug but a misunderstanding on the behavior of
:gt(0).The described behavior of
:gt(index)isIt is important to understand that the matched set of elements is determined by the selector
.getform tdwhich yields alltd's(in your case 4 td's) and then:gt(0)is applied which excludes the firsttdin the set and returns the other 3. The:gt(index)operates on the matched elements not on the relative "position" of the element inside it's parent.To achieve what you want the solution given by you
.getform td:not(:first-child)is the right way to go.For completeness here another test case which uses a
:nth-child(an+b)selector to achieve the same result.