Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9315 closed bug (duplicate)

$('#myElement').attr('checked') does not work for checkbox inputs for Chrome

Reported by: anonymous Owned by:
Priority: low Milestone: 1.next
Component: attributes Version: 1.6
Keywords: Cc:
Blocked by: Blocking:


Using jQuery 1.6.0 and Chrome 11.0.696.68, $('#myElement').attr('checked') is undefined when myElement is unchecked.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>

    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $('#cb').change(function () {
                window.alert("value: " + $('#cb').attr('checked').toString());

    <input type="checkbox" id="cb" name="cb" />

Change History (3)

comment:1 Changed 12 years ago by anonymous

jsFiddle link to the code: http://jsfiddle.net/jDVcr/

comment:2 Changed 12 years ago by Timmy Willison

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

comment:3 Changed 12 years ago by Timmy Willison

Duplicate of #9191.

Note: See TracTickets for help on using tickets.