Skip to main content

Bug Tracker

Side navigation

#9894 closed bug (worksforme)

Opened July 22, 2011 07:15PM UTC

Closed July 22, 2011 08:59PM UTC

jQuery attr() returns undefined in Firefox/Chrome when used on the attribute "value".

Reported by: ivolodin@vistaprint.com 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/

Attachments (0)
Change History (1)

Changed July 22, 2011 08:59PM UTC by timmywil comment:1

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/