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 comment:1
component: | unfiled → attributes |
---|---|
priority: | undecided → low |
resolution: | → invalid |
status: | new → closed |
Changed May 17, 2011 08:15AM UTC by 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.
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.