Bug Tracker

Modify

Ticket #10274 (closed bug: duplicate)

Opened 21 months ago

Last modified 15 months ago

checked broken for radio buttons

Reported by: sam.garnham@… Owned by:
Priority: low Milestone: None
Component: attributes Version: 1.6.4rc1
Keywords: Cc:
Blocking: Blocked by:

Description

 http://jsfiddle.net/uvpAc/1/

Reproduced with both 1.6.3 and 1.6.4 - fine in 1.6.2.

Two radio buttons with second checked. onclick of first, attr("checked") still returns "checked" for the second.

Change History

comment:1 Changed 21 months ago by addyosmani

  • Priority changed from undecided to low
  • Resolution set to worksforme
  • Status changed from new to closed
  • Component changed from unfiled to attributes

Thanks for submitting a ticket. I've reviewed your test case and I believe you're incorrectly using .attr() rather than .prop() to check for the checked value. If you take a look here, a corrected version of your test case works fine with both jQuery 1.6.2,.3 and edge (.4).  http://jsfiddle.net/addyosmani/uvpAc/3/

See here for just one of the explanations behind .attr() vs .prop() (noting that this change was introduced in jQuery 1.6):  http://forum.jquery.com/topic/please-explain-attr-vs-prop-change-in-1-6

comment:2 Changed 21 months ago by timmywil

  • Status changed from closed to reopened
  • Resolution worksforme deleted

This is legit. We have the boolHook in place so that attr will work as it did before for booleans. We encourage people to use prop for boolean attributes, but attr should work as well until it is officially deprecated. I'm marking this ticket as a dupe of a later one.

comment:3 Changed 21 months ago by timmywil

  • Status changed from reopened to closed
  • Resolution set to duplicate

comment:4 Changed 21 months ago by timmywil

Duplicate of #10278.

comment:5 Changed 21 months ago by addyosmani

Thanks for the clarification on this one timmywil!

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.