Find which link is clicked +jquery

hi to all,

i have a list of records with link with each record

i have like this table structure


after that dynamic tr and td are created which list the name of cateogy and its image
<td><a id=“1” href=“#” /><img src=‘./images/c1.jpg’ /></a></td>
<td><a id=“2” href=“#” /><img src=‘./images/c2.jpg’ /></a></td>


<a id is dynamic i want when i click this image link i get the value of which link is clicked


Assuming you have assigned a function as an onclick handler for each of these links, you can use the this keyword to reference the link element. For example,

function myOnClickHandler() {

btw- a number is not a valid id.

thanks for reply,

i want to do it in jquery not in simple javascript



but i want that this a should be call when click on a within this table not if i click on any other link .


I don’t understand.

Give the table an ID first, then you can add the following jQuery:

$('#tableID a').click(function(){