views:

20

answers:

1

Hi,

I'm having some probs with event propagation, I understand the concept, but I don't understand how to squash the default YUI behaviour.

I have this markup: [divElement id="container"][imageElement ... /][/divElement]

I have added a click event to the container element like so: ye.on(yd.get('container'), 'click', function(el){ // do stuff });

Ok, so I click the img, and ye.getTarget(); tells me the target was the img, which it is because I clicked it - but I assigned the handler to the container, not the img. In my situation it is important that I manipulate only the container, and not the img.

How can I ensure that when I click either the container or the img, that the target of my click event is only the container?

cheers, d

A: 

Time to make myself look like a dork:

http://yuilibrary.com/forum/viewtopic.php?f=14&t=3846&p=13336#p13336

All I needed was to access the default context for the event, by using the 'this' keyword. That's it, that was all.

Danjah