Reputation: 2337
How can I get the selection of the first td based on the first row using the class name?
<tbody id="logBody">
<tr class="logArow">
<td>Log Name</td>
<td>Log Information</td>
</tr>
</tbody>
I've gotten this far but got stuck and not sure how to get first child of td....
$("#logBody > tr.logArow").first()
Upvotes: 0
Views: 52
Reputation: 39268
One example that is close to what you already had:
$("#logBody > tr.logArow > td:first")
Upvotes: 0
Reputation: 150273
Here is a partial list of how it can be done:
$("#logBody > tr.logArow > td:eq(0)")
$("#logBody > tr.logArow > td").eq(0)
$("#logBody > tr.logArow > td:first-child")
$("#logBody > tr.logArow > td").first()
$("#logBody > tr.logArow > td:first")
$("#logBody > tr.logArow > td").slice(0,1)
Upvotes: 2
Reputation:
There are multiple ways to do this. Here's one:
$("#logBody td:first-child")
For more, browse this page.
Upvotes: 2