Skip to main content

Bug Tracker

Side navigation

#2610 closed bug (invalid)

Opened March 28, 2008 02:40PM UTC

Closed March 28, 2008 04:15PM UTC

"return false" doesn't work

Reported by: telega Owned by:
Priority: major Milestone: 1.2.4
Component: event Version: 1.2.3
Keywords: Cc:
Blocked by: Blocking:

I have 2 onclick handlers assigned to a document, each one returning false. But clicking on the document causes both handlers to be invoked disregarding "return false". Happens in all the browsers (FF 3, Opera 9, IE 7). Tried "click" and "mousedown" events, both have the same behavior.

<script src="jquery-1.2.3.js"></script>
  $(document).ready(function() {
    $(document).bind("click", "data1", function() { alert('click1'); return false; });
    $(document).bind("click", "data2", function() { alert('click2'); return false; });
Attachments (0)
Change History (1)

Changed March 28, 2008 04:15PM UTC by scott.gonzal comment:1

resolution: → invalid
status: newclosed

Straight from the docs:

To stop both default action and event bubbling, your handler has to return false. Note that this will prevent handlers on parent elements from running but not other jQuery handlers on the same element.