Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about first-child JQuery selector

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
I'm reading the second chapter of "JQuery In Action"
To get languages names, this selector is used:

table#languages tbody td:first-child

tbody contains four <tr> and each <tr> contains three <td>
Why the previous selector get the first <td> of each <tr>?
Thanks.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if this answers your question:

:first matches only a single element
:first-child matches an element for each of its parents

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic