Colin

Posted on Saturday, May 15, 2010

Overcoming live() events and stopPropagation

As long as the parent element detect that the event was triggered by an anchor, it stop executing.

This is a method to replace stopPropagation() function which doesn't work in live() events.

$('body').live('click', function(e) {
// bail out if this event was triggered by an anchor
if ( $(e.target).is('a') ) { return; }

// do cool stuff down here
});

Source: http://forum.jquery.com/topic/overcoming-limitations-of-live-events-and-stoppropagation

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home