The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Event delegation and "sliding door" links? Re: Event delegation and “sliding door” links?

The event handler inspects ids to figure out what was clicked on. This means that if you click on an EM element within the link, the event handler will never know that one of the sliding door links was clicked.

Ok i just focused on the quote above… But i know jquery has a .data() function and it can be used like so

var $this = $(this),
data = $‘clicked’);

if(data) $‘clicked’, false);
else $‘clicked’, true);

return false;


Im not sure on the requirement on using $("#demo") as the selector but that is doing the same thing as (‘#demo a’)

The html was the same but just cleared out the id’s on the anchors

Note: only time the <em> being clicked on becomes an issue is if you attach a click handler event on it then you just need to go to "$(this).parent(‘a’).data(……" this being the <em>