How to remove the current node

使用ChildNode.remove()

document.querySelector(".content p").childNodes[0].remove();

 

note:

1. Here the parent node of the current node must be used, and therefore is not applicable to the document node / nodes and other fragments of the document;

2. Here the current node may be the parent of all the nodes having node elements / text node and the like;

Guess you like

Origin www.cnblogs.com/aisowe/p/11530873.html