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 NishimaNishima2 Answers
Reset to default 3You 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
评论列表(0条)