Skip to main content

Bug Tracker

Side navigation

#3077 closed bug (invalid)

Opened June 23, 2008 07:26PM UTC

Closed June 24, 2008 07:24PM UTC

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.

Attachments (0)
Change History (2)

Changed June 23, 2008 07:30PM UTC by ThrushAAX comment:1

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

Changed June 24, 2008 07:24PM UTC by flesler comment:2

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.