This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Question about first-child JQuery selector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Question about first-child JQuery selector" Watch "Question about first-child JQuery selector" New topic

Question about first-child JQuery selector

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3476

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>?
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
Not sure if this answers your question:

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

Don't get me started about those stupid light bulbs.
subject: Question about first-child JQuery selector
Similar Threads
How do I update table using postJSON
jQuery wrapAll()?
Creating CSS class at runtime
HTML table to JSF table
Need Help with Jquery Selector logic