Search code examples
jqueryevent-bubbling

Prevent click bubbleup without return false


How do i prevent a bubble up the dom when doing something like this:

$("*").live('mousemove',function(e){
    page.change_state();
});

Where we need any click handler that that element also has to execute, but we dont want this action repeating up the DOM.

We cannot use preventDefault or return false


Solution

  • Use event.stopPropagation().