Bug Tracker

Opened 8 years ago

Closed 8 years ago

#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:
Blocked by: Blocking:

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 (1)

comment:1 Changed 8 years ago by timmywil

Component: unfiledattributes
Milestone: None1.6.2
Priority: undecidedlow
Resolution: worksforme
Status: newclosed

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

Note: See TracTickets for help on using tickets.