Bug Tracker

Opened 12 years ago

Closed 12 years ago

#3077 closed bug (invalid)

Toggle on checkboxes

Reported by: ThrushAAX Owned by:
Priority: major Milestone: 1.3
Component: event Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:

Description

Unexpectedly when a checkbox has a .toggle() bound to it the state will not change after its callback function is completed. The state will change within the callback function but it will not be saved.

Example Code:

$("input").toggle(function(){
   console.log("A",this,this.checked)
},
function() {
   console.log("B",this,this.checked)
});

Output:

A <input type="checkbox"> true
B <input type="checkbox"> true

If this is intentional it should probably be documented.

Change History (2)

comment:1 Changed 12 years ago by ThrushAAX

and I can't believe I selected 1.2.5 instead of 1.2.6 ...

comment:2 Changed 12 years ago by flesler

Component: coreevent
Milestone: 1.2.51.3
Resolution: invalid
Status: newclosed
Version: 1.2.51.2.6

Because toggle() calls e.preventDefault() which prevents the click from executing. Use the events mouseenter and mouseleave instead.

Note: See TracTickets for help on using tickets.