javascript element.parentNode.removeChild() 方法在 Internet Explorer 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12417943/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
element.parentNode.removeChild() method not working in internet explorer
提问by Shekhar
I am trying element.parentNode.removeChild()
method. Its working fine in Firefox but not working in IE 9.
我正在尝试element.parentNode.removeChild()
方法。它在 Firefox 中运行良好,但在 IE 9 中不起作用。
Can anyone please tell how to remove an element in IE using javascript?
谁能告诉我如何使用javascript删除IE中的元素?
Thanks...
谢谢...
回答by Filling The Stack is What I DO
Use removeChild
function in the parentNode of the element.
removeChild
在元素的 parentNode 中使用函数。
If element
is the node that needs to be removed, then do this:
如果element
是需要删除的节点,则执行以下操作:
element.parentNode.removeChild(element)