How to create an empty, non-null jQuery object ready for appending?

后端 未结 6 2016
傲寒
傲寒 2021-02-06 21:04

I want to append some html to an empty non null jQuery object only in the loop but it\'s not working unless I create an object and add an html tag during creation. How can I cre

6条回答
  •  半阙折子戏
    2021-02-06 21:34

    Document Fragments are perfect for this; creates an empty object ready for appending. :)

    $(document.createDocumentFragment())
    

提交回复
热议问题