Ticket #9894 (closed bug: worksforme)
jQuery attr() returns undefined in Firefox/Chrome when used on the attribute "value".
| Reported by: | ivolodin@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.6.2 |
| Component: | attributes | Version: | 1.6.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
It looks like function attr has been modified in jQuery 1.6.1 to use attrHooks collection. Because of that, if you are trying to retrieve a value of the "value" attribute, it executes the code that does element.value. Line 2193 in jQuery forks the code so that for the attributes within attrHooks it wouldn't use element.getAttribute() function. "value" is allowed attribute for some elements, like input fields, and you can get it through element.value, but for elements like "div" it's a custom attribute, and you can't retrieve it through .value. Please look at the link attached for an example.
Sample here: http://jsfiddle.net/gd2Ms/1/
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.

Works fine in latest version of jQuery: http://jsfiddle.net/timmywil/gd2Ms/2/