Bug Tracker

Opened 10 years ago

Closed 10 years ago

#13716 closed bug (duplicate)

checkbox attr/removeAttr problems

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.0
Keywords: Cc:
Blocked by: Blocking:


I believed the bug is involved with the version 1.9.0. Here is a simple example: <html>


<script src="./jquery-1.9.0.js" type="text/javascript"></script>

</head> <body>

<input id="test" type="button" value="click"> <fieldset>

<input class="test" type="checkbox" value="a"> <input class="test" type="checkbox" value="b"> <input class="test" type="checkbox" value="c"> <input class="test" type="checkbox" value="d"> <input class="test" type="checkbox" value="e">


</body> <script>






$(this).attr('checked', 'checked');





Here are the steps:

  1. Click the button, all the elements are checked.
  2. Click again, no checked.
  3. Click again, the attribute 'checked' is absolutely added, but the box is not checked.

The versions after 1.8.3 have the problem, but the version 1.8.3 is ok.

Change History (1)

comment:1 Changed 10 years ago by m_gol

Resolution: duplicate
Status: newclosed

Duplicate of #13667.
Use prop(), not attr() for this.

Note: See TracTickets for help on using tickets.