IE11: select元素在改变option.text时冻结

IE11: select element freezes on changing option.text

本文关键字:option text 冻结 改变 select 元素 IE11      更新时间:2023-09-26

我使用纯javascript更改选项的文本到一些事件上的其他东西。之后,Select(multiselect)元素冻结。如果我注释下面的第2行,那么Select元素将不会冻结。有什么建议吗?我想只用javascript。

function updateSelect(select)
{
 var opt = select.options[select.selectedIndex];
opt.text =  "-";//--2
..
..
}

我可以用Jquery与.text()函数。

$("#"+opt.id).text("-");

这将解决问题:

    option.textContent = "-";