Bug Tracker


Ticket #1047 (closed bug: fixed)

Opened 7 years ago

Last modified 7 years ago

unbind(type) does not work as expected when `type` is not bound to the jQuery

Reported by: humbleice Owned by:
Priority: minor Milestone: 1.1.3
Component: event Version: 1.1.1
Keywords: unbind Cc:
Blocking: Blocked by:


The unbind function will remove all events attached to a jQuery object if it cannot find an event of the type given in the unbind params.

For example: The following code will create a div element with an attached click event. On click, an alert should pop-up and unbind any mouseup events to the jQuery object. Because there is no onMouseUp event attached to the object, the unbind call will unattach the onClick event preventing the alert from appearing when the div element is clicked again.

$("<div id='hi'>Div with broken unbind function</div>")
    function() {

The code below is a duplicated of the code above but the created Div element has an attached onMouseUp event. In this case, unbind("mouseup") works as expected and the onClick alert will appear anytime the user clicks the Div element (and the mouseup alert will be removed after the first click)

$("<div id='hi'>Div when unbind works as expected</div>")
    function() {
    function() {

FireFox (fix needed for unbind related plugin)

Change History

comment:1 Changed 7 years ago by brandon

  • Status changed from new to closed
  • Resolution set to fixed

This has been fixed in Rev 1471.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.