Side navigation
#13514 closed bug (fixed)
Opened February 25, 2013 02:17PM UTC
Closed March 22, 2013 04:49PM UTC
Last modified August 26, 2013 11:21PM UTC
Setting "wrong" value of select-element using .val() is inconsistent in IE9 compared to other browsers
Reported by: | andre.brunnsberg@gmail.com | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.10/2.0 |
Component: | attributes | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Check this Fiddle:
If the page has a select-element and the value for the select-element is changed using .val(xxx) but with a value that isn't found in the select-element's options then IE9 changes the select element to show an empty option, in all other browsers tested (IE8, IE10, FF, Chrome) it changes the selected value to be the first option.
Attachments (0)
Change History (8)
Changed February 25, 2013 03:05PM UTC by comment:1
component: | unfiled → attributes |
---|---|
milestone: | None → 1.9.2 |
priority: | undecided → low |
status: | new → open |
Changed February 26, 2013 07:44AM UTC by comment:2
Also checked that it doesn't help to set one of the select-element's options as selected, IE9 still changes the element to show an empty option.
Changed March 13, 2013 04:28PM UTC by comment:3
Relevant discussion is at https://github.com/jquery/jquery/pull/1191
Changed March 22, 2013 04:49PM UTC by comment:4
resolution: | → fixed |
---|---|
status: | open → closed |
Fix #13514: Set selectedIndex to -1 when non-matching value is set on a select. Close gh-1191.
(cherry picked from commit 48d71d0c3e53d1bb1688fc6c0593b008ced3403b)
Changeset: c9ca9bf509edd1dc0a92564210f3f325cc7555b6
Changed March 22, 2013 04:49PM UTC by comment:5
Fix #13514: Set selectedIndex to -1 when non-matching value is set on a select. Close gh-1191.
Changeset: 48d71d0c3e53d1bb1688fc6c0593b008ced3403b
Changed May 24, 2013 01:43PM UTC by comment:7
milestone: | 1.9.2 → 1.10/2.0 |
---|
Bulk update to milestone 1.10/2.0
Changed August 26, 2013 11:21PM UTC by comment:8
Seems like it is happening again on FF on a Mac.
When setting $el.val(nonexistence) it creates an empty first option.
Although it seems like a bad idea to depend on this because HTML4 left it to the browser, the HTML5 spec did standardize the case:
Compare to the HTML4 language:
Looks like this was fixed in IE10.