Modify ↓
Ticket #8731 (closed bug: worksforme)
:checked pseudo selector returns duplicate elements for JavaScript-checked input checkboxes
| Reported by: | devonnigelreed@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | unfiled | Version: | 1.4.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Example:
I create an input checkbox - say with id "test" then check it manually. If I evaluate $('#test:checked').length, I will get 1. However, if I use JavaScript to check the checkbox, say with $('#test').attr('checked', true), then $('#test:checked').length will return 2.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Thanks for submitting a ticket to the jQuery Bug Tracker. I've created a minimal test case based on the information you've provided us with, but whether checked is initially set and changed using attr() later on or unset and adjusted, both cases appear to be working fine with the length being returned correctly. See here for the minimal test: http://jsfiddle.net/AKXrU/