In code I have a reference to a DOM element, in Jquery. How do I find out it\'s id? It maybe counter-intuitive, but I need to know that so I can do some manipulations on another
If you have a reference to a DOM element, you can simply access the ID with this.id
or element.id
.
Here is a list of properties, HTMLElement
s have.
If you want the id then you can use
$("youelementselector").attr("id");
and if you want elements name then
$("youelementselector").attr("name");
See attr
$(this).attr("id")