Getting the ID of an object when the object is given
Posted
by Pieter
on Stack Overflow
See other posts from Stack Overflow
or by Pieter
Published on 2010-03-29T16:16:42Z
Indexed on
2010/03/29
16:23 UTC
Read the original article
Hit count: 447
I have link that calls a function when clicked:
<a href="javascript:spawnMenu(this);" id="link1">Test1</a>
To make my function work, I need access to the object so that I can perform jQuery operations like this:
alert($(objCaller).offset().left);
Since objCaller
points to the object and not the object ID, this won't work. I need something like this:
alert($("a#link1").offset().left);
How can I get the object ID from objCaller
?
© Stack Overflow or respective owner