Skip to main content

Bug Tracker

Side navigation

#5721 closed bug (worksforme)

Opened December 28, 2009 06:05PM UTC

Closed October 09, 2010 04:06AM UTC

Last modified March 15, 2012 10:41AM UTC

Webkit: Radio checked state incorrect when creating an input with a name

Reported by: sirshannon Owned by:
Priority: low Milestone: 1.4
Component: core Version: 1.4a2
Keywords: webkit input radio checked Cc:
Blocked by: Blocking:

In Chrome and Safari, I'm getting an error creating a radio with a checked state:

$('<input type="radio" checked=""/>')[0].checked

// returns true

$('<input type="radio" checked="" name="foo"/>')[0].checked

// returns false

Both of the above examples properly return true in FF and IE.

Attachments (0)
Change History (3)

Changed December 28, 2009 09:50PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

The checked attribute should be set to the value "checked" in the markup; setting it to an empty string isn't consistent across doctypes. When the value is set via jQuery you should use a boolean, e.g.,

.attr("checked", true)

Changed January 12, 2010 05:03PM UTC by sirshannon comment:2

resolution: invalid
status: closedreopened

Regardless of what the doctypes say about the attribute, I would expect the behavior to be consistent in both cases. Whether or not 'checked=""' is valid doesn't change the fact that the first example works, but the second example doesn't. This is a bug.

Changed October 09, 2010 04:06AM UTC by addyosmani comment:3

priority: majorlow
resolution: → worksforme
status: reopenedclosed

I just ran your original test case in Chrome and Safari and was able to get the exact same output experienced in FireFox and IE.

Check here:

If the originally mentioned issue persists, please feel free to submit a new ticket and we will investigate once again. Closing for now.