Reputation:
I want to select a link which is inside table tr td
<table>
<tr>
<td><a href=""></a></td>
</tr>
</table>
This is my selector, but it is not working:
$(table#id tr>td>a.linkid);
Upvotes: 0
Views: 63
Reputation: 3648
If you have an id on the link you can just write $('#linkID');
Or you can try jQuery find()
: http://api.jquery.com/find/
Upvotes: 0
Reputation: 50009
Here's a demo : http://jsfiddle.net/jomanlk/bncas/
<table>
<thead>
<tr>
<th>Title </th>
<th>Title 2</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href='http://somesite.com'></a></td>
<td><a class='linkid' href='http://correctsite.com'></a></td>
</tr>
</tbody>
</table>
$('td a.linkid').each(function(){
$(this);// reference to link
});
$('td a.linkid:first'); //reference to first link
Upvotes: 1