Bug Tracker

Opened 12 years ago

Closed 12 years ago

#10248 closed bug (invalid)

Checkbox attribute "checked" error

Reported by: anonymous Owned by:
Priority: low Milestone: None
Component: attributes Version: 1.6.3
Keywords: Cc:
Blocked by: Blocking:



here is a simple game http://jsfiddle.net/X6XnV/

when you press 1-3-1

it should uncheck 2 and check 3 and its work properly in 1.5.2 but not work in 1.6

Change History (1)

comment:1 Changed 12 years ago by timmywil

Component: unfiledattributes
Priority: undecidedlow
Resolution: invalid
Status: newclosed

.attr("checked", "") will set the checked attribute to empty string, which is still true. The mere presence of the checked attribute indicates that it is true. It was a mistake that this set the checked property to empty string in versions of jQuery prior to 1.6, which in a roundabout way got treated as false. This is one reason why it was always recommended to use .removeAttr('checked') instead. Nevertheless, the recommended way to set the checked property to false is

.prop('checked', false)
Note: See TracTickets for help on using tickets.