使用document.createComment().

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

如上所示, 我们在body子元素顶部增加了一个注释节点: <!--helloworld-->

 

相关文章:

  • 2022-12-23
  • 2021-11-13
  • 2021-12-06
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2022-02-16
  • 2021-10-08
相关资源
相似解决方案