Link to home
Create AccountLog in
Avatar of exalkonium
exalkoniumFlag for United States of America

asked on

How to get ID of element that triggered an event with class name

Hello again,

I am trying to find out the ID of an element that triggered a mouseover event handler. I am using the prototype framework, and am using the invoke method to listen to multiple DIV tags for mouseovers by class name. In part of my function, I need to access the actual name of the ID that triggered the event. Anyone have any insight?
//////The window onload event listener
Event.observe(window, 'load', function() {
   //////Here I listen for mouseovers that occur on elements with the 'navimage' classname
   $$('div.navimage').invoke('observe', 'mouseover', overfade);
function overfade(evnt) {
   var obj = Event.element(evnt);
   ////in here is where I need to find the name of the element that triggered this function

Open in new window

Avatar of nivlam
Flag of United States of America image

Link to home
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of exalkonium


Thanks, man. Perfect!