There are multiple links with random ids as shown below:
<a href="#" class="remove_pid" id="pid_123">Remove 123</a>
<a href="#" class="remove_pid" id="pid_234">Remove 234</a>
<a href="#" class="remove_pid" id="pid_567">Remove 567</a>
<a href="#" class="remove_pid" id="pid_890">Remove 890</a>
An event handler has been set up like this:
$$('.remove_pid').addEvents({
'click': removePid
});
which triggers the following function:
function removePid(event)
{
alert('How can I retrieve the element id???');
}
The main query is how to retrieve the element id within the removePid() function.
UPDATE:
@Aishwar, event.target.id appears to work in a specific scenario, but not in my case
<a href="#" class="remove_pid"><img src="/123.jpg" id="pid_123"></a>
UPDATE 2:
Initially overlooked, the content is an image instead of the text "Remove 123" as illustrated below:
<a href="#" class="remove_pid" id="pid_123"><img src="/123.jpg"></a>
Therefore, appreciation to @Dimitra for bringing it to attention. The downvote was unexpected, but I acknowledge its legitimacy.