Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in prop() documentation, regarding statement about checkbox state and attr() #288

Closed
jwatkin opened this issue Apr 26, 2013 · 3 comments · Fixed by #1180
Closed

Comments

@jwatkin
Copy link

jwatkin commented Apr 26, 2013

On this page:
http://api.jquery.com/prop/

this line of text seems wrong:

"$(elem).attr("checked") (1.6.1+) "checked" (String) Will change with checkbox state"

shouldn't this read, "Initial state of the checkbox; does not change" instead?

The Example just below it seems to support my opinion.

Jim

@mattflaschen
Copy link
Contributor

Indeed, there are two parts in direct contradiction:

' $(elem).attr("checked") (1.6.1+) "checked" (String) Will change with checkbox state'

'The checked attribute value does not change with the state of the checkbox'

The top one is correct in 1.8.3. Specifically, it switches between the string "checked" and undefined, depending on whether it's checked.

@timmywil
Copy link
Member

Thanks! Yes, that needs to be corrected. It was changed to the correct behavior in 1.9/2.0.

@Krinkle
Copy link
Member

Krinkle commented Nov 30, 2015

Seems to be still there. http://api.jquery.com/attr/ states:

$( elem ).attr( "checked" ) (1.6) "checked" (String) Initial state of the checkbox; does not change
$( elem ).attr( "checked" ) (1.6.1+) "checked" (String) Will change with checkbox state

Thus suggesting that in the latest stable version, the returned attr value does change with the live state. Aside from whether that's desirable, the current demo does not match this statement. The demo (using jQuery 1.10.2 as of writing) shows a constant value of "checked" regardless of the checkbox's state.

I can reproduce the same behaviour in jQuery 2.1.3 (value unaffected by the live state).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants