Skip to main content

Bug Tracker

Side navigation

#9088 closed bug (invalid)

Opened May 04, 2011 08:30AM UTC

Closed May 04, 2011 02:15PM UTC

Last modified July 08, 2011 02:50PM UTC

selectedIndex bug v1.6

Reported by: apapai@freemail.hu Owned by:
Priority: low Milestone: 1.next
Component: attributes Version: 1.6
Keywords: Cc:
Blocked by: Blocking:
Description
$(anySelectElement).attr('selectedIndex')

Using this script returns "0" instead of the proper numeric index value. Setting a new value (as numeric) has no effect on the select element and then also returned as string. With v1.5.1 this works as expected.

Attachments (0)
Change History (7)

Changed May 04, 2011 02:15PM UTC by timmywil comment:1

component: unfiledattributes
priority: undecidedlow
resolution: → invalid
status: newclosed

As of jQuery 1.6, properties such as selectedIndex should no longer be retrieved with attr as the ambiguity between properties and attributes has been removed by the addition of the http://api.jquery.com/prop method. For more information, see the release notes.

Changed May 17, 2011 08:15AM UTC by anonymous comment:2

$(anySelectElement).attr('selectedIndex'); Doesn't work in IE, returns an 'undefined' (at least with 1.5.x)

$(anySelectElement)[0].selectedIndex; Does work in IE and the rest

But using the .prop() as of 1.6 is of course the best way to go.

Changed June 17, 2011 09:44PM UTC by timmywil comment:3

#9612 is a duplicate of this ticket.

Changed June 22, 2011 01:26PM UTC by timmywil comment:4

#9644 is a duplicate of this ticket.

Changed June 26, 2011 05:16AM UTC by timmywil comment:5

#9670 is a duplicate of this ticket.

Changed June 28, 2011 04:31PM UTC by ajpiano comment:6

#9685 is a duplicate of this ticket.

Changed July 08, 2011 02:50PM UTC by timmywil comment:7

#9784 is a duplicate of this ticket.