且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

style.display='none' 不适用于 chrome 中的选项标签,但它适用于 Firefox

更新时间:2023-10-22 21:46:52

解决方法是删除 option 元素以响应您的事件,并在需要时将它们添加回来.IIRC,IE 不允许您将 option 元素上的 display 设置为 none.我建议将删除的元素存储在一个数组中,以便您可以轻松地将它们添加回来.

The workaround is to remove the option elements in response to your event and add them back if and when they are needed. IIRC, IE will not allow you to set the display to none on option elements. I would advise storing the removed elements in an array so that you can easily add them back in.