JavaScript removeNode() is not working in Chrome - Stack Overflow

I need to remove a node from a page, and for that I am using the below mentioned functiondocument.getEl

I need to remove a node from a page, and for that I am using the below mentioned function

document.getElementById(id).removeNode(true);

This function works fine in IE but not in Chrome. Could anyone tell me how should I do it?

I need to remove a node from a page, and for that I am using the below mentioned function

document.getElementById(id).removeNode(true);

This function works fine in IE but not in Chrome. Could anyone tell me how should I do it?

Share Improve this question edited Jul 17, 2016 at 8:14 Mahdi Alkhatib 1,9821 gold badge32 silver badges43 bronze badges asked Sep 9, 2009 at 9:50 NishimaNishima
Add a ment  | 

2 Answers 2

Reset to default 3

You can use removeChild, it works in most browsers.

The function removeNode() seems to be a Microsoft proprietary function, so probably only supported in Internet Explorer (IE).

Since the latest browsers are typically chromium-based (such as Google Chrome and Microsoft Edge "Wave" v79+) I replaced it with remove() and it seemed to fix the issue:

document.getElementById(id).remove();

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745365509a4624558.html

相关推荐

  • JavaScript removeNode() is not working in Chrome - Stack Overflow

    I need to remove a node from a page, and for that I am using the below mentioned functiondocument.getEl

    13小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信