search

Home  >  Q&A  >  body text

How to automatically add comments to the first line of HTML

Similar to the picture, you cannot see the first line of comments when opening it with an editor. How is this generated?微信截图_20230226053006.jpg

P粉342138710P粉342138710675 days ago561

reply all(2)I'll reply

  • 入道人

    入道人2023-03-10 13:19:36

    You can create document fragments through js code

    Create and generate comments

    var name = document.createComment() //创建注释
    var farme = document.createDocumentFragment('frame');//创建文档片段
    farme .appendChild(name)

    reply
    0
  • P粉342138710

    Thanks boss

    P粉342138710 · 2023-03-10 21:02:29
  • Cancelreply