0

I have a problem when I try to remove an option from a select using JS. When I run the following code with IE 11 I get 2 options while with any other browsers 3 options.

var x = document.getElementById("mySelect");
x.remove(0);
<select id ="mySelect" >
  <option value="1">Test1</option>
  <option value="2">Test2</option>
  <option value="3">Test3</option>
  <option value="4">Test4</option> 
</select>

My IE version is 11.1088.15063.0 and update version 11.0.65 (KB4103768). I tested in different machines and for some users work with IE 11 (different version). I tried to clear the cache and reset the browser, anything else that you can think of?

collection.remove(index) is supported in IE : https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/remove

  • IE doesn't support `childNode.remove()`: https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove Also the number in the parenthesis is wrong syntax – Asons May 30 '18 at 10:07
  • 2
    Possible duplicate of [Error with getElementById(id).remove() in IE11](https://stackoverflow.com/questions/35085503/error-with-getelementbyidid-remove-in-ie11) – Tan Duong May 30 '18 at 10:08
  • I can give you the information, that also 11.0.9600.19002 returns 3 Options, which is the correct behaviour. Unfortunably, I dont know, if older versions you mentioned have a problem with this... Do you tested this with the code above on multiple machines or your page? Another suggestion, you may check, if you have used the same ID several times? – Christian Müller May 30 '18 at 10:10
  • Sorry I noticed that the browser version is different, in 11.0.9600.19003 (windows 8.1) works fine. I believe 11.1088.15063.0 is the latest IE version for windows 10 . I think I will have to ask Microsoft. Strange that I cannot find other users with the same issue. – Simone Tagliaro May 30 '18 at 10:51

0 Answers0