error77
asked on
Javascript detect ID clicked ?
Hi all,
Is it possible at all to detect if an id has been clicked?
For example: I want a link on a page containing an ID to be detected by javascript if it was click.
The javascript would look like this...
if (ID was clicked) {
alert("id was clicked");
}
something like that anyway..
Can this be done?
Thanks
Is it possible at all to detect if an id has been clicked?
For example: I want a link on a page containing an ID to be detected by javascript if it was click.
The javascript would look like this...
if (ID was clicked) {
alert("id was clicked");
}
something like that anyway..
Can this be done?
Thanks
$("a").click(function() { if( $(this).attr("id") == "ID" ) {
alert("id was clicked");
}});
or if you create the link dynamically :
$("a").live("click", function() { if( $(this).attr("id") == "ID" ) {
alert("id was clicked");
}});
ASKER
Looks perfect but I need to change the code in the plugin js file so I don't think I can use JQuery for this.
What would the pure javascript translation be please?
What would the pure javascript translation be please?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks !!!
Are you using a library like jQuery, or just straight up javascript?