Opened 8 years ago

Closed 7 years ago

#7476 closed bug (notabug)

Button: Dynamically injecting a "checked" checkbox has the incorrect state

Reported by: duereg Owned by:
Priority: minor Milestone: 1.11.0
Component: ui.button Version: 1.8.9
Keywords: Cc:
Blocked by: Blocking:

Description

I am trying to create a button that contains a checkbox - but not a checkbox button.

In my code, I set the state of the checkbox to checked. If I load this checkbox without putting it into the button, I can confirm that the checkbox is checked.

However, as soon as the div containing the checkbox has .button called on it, the checkbox is unchecked.

http://jsfiddle.net/KzsVG/6/

I've tested this against IE 9, Firefox 4, Chrome 12, and this behavior is consistent across browsers.

Change History (3)

comment:1 Changed 8 years ago by Scott González

This only happens with when the checkbox is checked programmatically. Changing the code to created a checked checkbox using $( "<input type=checkbox checked>" ) doesn't have a problem.

comment:2 Changed 7 years ago by Scott González

Milestone: 1.9.01.11.0

comment:3 Changed 7 years ago by bchiasson

Resolution: invalid
Status: newclosed
Summary: Creating a button containing a checkbox - but not a checkbox button - removes the state of the checkboxButton: Dynamically injecting a "checked" checkbox has the incorrect state

It seems like you are trying to reflect the state of the "button" in this situation. Please see the below JSFiddle for an example of how you might accomplish this without using a "checkbox" within a button.

http://jsfiddle.net/bchiasson/KzsVG/7/

Note: See TracTickets for help on using tickets.