#9088 closed bug (invalid)
selectedIndex bug v1.6
Reported by: | 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 12 years ago by
Component: | unfiled → attributes |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 12 years ago by
$(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.
Note: See
TracTickets for help on using
tickets.
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.