How to create and insert a comment node

Use document.createComment ().

document.body.prepend(document.createComment('helloworld'));

As indicated above, we added a comment node at the top of body sub-elements: <-! Helloworld ->

 

Guess you like

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