Skip to main content

Search and Top Navigation

#7476 closed bug (notabug)

Opened June 15, 2011 03:12AM UTC

Closed October 15, 2012 08:30PM UTC

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:

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.

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

Attachments (0)
Change History (3)

Changed June 15, 2011 12:47PM UTC by scottgonzalez comment:1

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.

Changed October 11, 2012 02:43PM UTC by scottgonzalez comment:2


Changed October 15, 2012 08:30PM UTC by bchiasson comment:3

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.