Reputation: 1606
I have this table with an element nested as follows:
table > tbody > tr > td > table > tbody > tr > td > a
None of the elements have an ID or a class.
Upvotes: 0
Views: 439
Reputation: 72299
You can pass the same in jQuery as selector:-
$('table > tbody > tr > td > table > tbody > tr > td > a').on('click',function(){
// do stuff
});
Working sample Example:-
$('table > tbody > tr > td > table > tbody > tr > td > a').on('click',function(){
alert($(this).attr('id'));
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td>
<a id="my_id">Click Me To Get my Id!</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
Upvotes: 3