Side navigation
#14686 closed bug (fixed)
Opened January 10, 2014 03:40PM UTC
Closed March 20, 2014 07:12PM UTC
Last modified September 19, 2014 06:34PM UTC
val() throws invalid argument in Internet Explorer 10-11
Reported by: | RoBorg@hotmail.com | Owned by: | markelog |
---|---|---|---|
Priority: | low | Milestone: | 1.11/2.1 |
Component: | attributes | Version: | 1.10.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The .val() method can throw an invalid argument exception when trying to retrieve the value in IE 11.
This is really an IE bug, not a jQuery bug, but it would be nice if jQuery could work around it.
The following code doesn't work in IE 11:
var x = $('<option/>'); x.val(); // This throws an exception
The root cause is this:
var e = document.createElement('option'); e.text; // This throws an exception
For anyone looking for a workaround, if you add a value attribute, then .text won't be read, e.g.
var x = $('<option value=""/>'); x.val();
Attachments (0)
Change History (7)
Changed January 12, 2014 07:39PM UTC by comment:1
component: | unfiled → attributes |
---|---|
priority: | undecided → low |
Changed January 12, 2014 07:40PM UTC by comment:2
summary: | val() throws invalid argument in Internet Explorer 11 → val() throws invalid argument in Internet Explorer 10-11 |
---|
Changed January 12, 2014 08:50PM UTC by comment:3
owner: | → markelog |
---|---|
status: | new → assigned |
Changed March 20, 2014 07:12PM UTC by comment:4
milestone: | None → 1.11/2.1 |
---|---|
resolution: | → fixed |
status: | assigned → closed |
Changed March 20, 2014 07:56PM UTC by comment:6
Changed September 19, 2014 06:34PM UTC by comment:7
Just a quick note to say that the underlying issue in IE has been fixed and will be released with the next major release. No specific timing to share yet, but news will be released via the IE Blog or @IEDevChat.
-Charles
Confirmed, but only for 1.x, also reproducible for IE10 – http://jsfiddle.net/2avmY/