HTML:
<div id="parent">
<div class="child">Test</div>
<div class="child">Test2</div>
</div>
Now I've got a click event handler that looks like:
YAHOO.util.Event.on('parent', 'click', clickDelegate);
function clickDelegate(e){
var origin = YAHOO.util.Event.getTarget(e, false);
if(YAHOO.util.Dom.hasClass(origin, 'child'))
alert(origin.innerHTML + ' was clicked.');
}
Now that works great...
My question is: How do I do that for the mouseover or mousemove event?
I can't seem to get that to work. here is what I'm doing now
(doesn't work):
YAHOO.util.Event.on('parent', 'mouseover', hoverDelegate);
function hoverDelegate(e){
var origin = YAHOO.util.Event.getTarget(e, false);
if(YAHOO.util.Dom.hasClass(origin, 'child'))
alert(origin.innerHTML + ' was hovered.');
}
my variable "origin" is always undefined. Hopefully you guys can see
what I'm trying to do. Any input would be appreciated.