Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#9088 closed bug (invalid)

selectedIndex bug v1.6

Reported by: apapai@… 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.

Change History (7)

comment:1 Changed 9 years ago by timmywil

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.

comment:2 Changed 9 years ago by anonymous

$(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.

comment:3 Changed 8 years ago by timmywil

#9612 is a duplicate of this ticket.

comment:4 Changed 8 years ago by timmywil

#9644 is a duplicate of this ticket.

comment:5 Changed 8 years ago by timmywil

#9670 is a duplicate of this ticket.

comment:6 Changed 8 years ago by ajpiano

#9685 is a duplicate of this ticket.

comment:7 Changed 8 years ago by timmywil

#9784 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.