jQuery event.stopPropagation is not working on <a>

Posted by HorusKol on Stack Overflow See other posts from Stack Overflow or by HorusKol
Published on 2010-04-20T01:08:08Z Indexed on 2010/04/20 1:13 UTC
Read the original article Hit count: 397

Filed under:
|
|

I have the following javascript:

$('#ge-display').click(function (event) {
  window.open('/googleearth/ge-display.php','','scrollbars=yes,menubar=no,height=650,width=1000,resizable=yes,toolbar=yes,location=no,status=no');
  event.stopPropagation();
  return false;
});

the element with id 'ge-display' is a standard link:

<a href="/googleearth/ge-display.php" id="ge-display" target="_blank">Load Google Earth Plugin (in a new window)</a>

The problem is - when I take out the 'return false;' line from the click event handler, the javascript popup opens, and then another browser window opens - I thought stopPropagation() would prevent the links own click handler?

I've also tried stopImmediatePropagation() - but I still need to return false to stop the default behaviour of the link.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about events