What is the most efficient way to create HTML elements using jQuery?

后端 未结 12 2625
甜味超标
甜味超标 2020-11-22 06:40

Recently I\'ve been doing a lot of modal window pop-ups and what not, for which I used jQuery. The method that I used to create the new elements on the page has overwhelming

12条回答
  •  独厮守ぢ
    2020-11-22 07:04

    If you have a lot of HTML content (more than just a single div), you might consider building the HTML into the page within a hidden container, then updating it and making it visible when needed. This way, a large portion of your markup can be pre-parsed by the browser and avoid getting bogged down by JavaScript when called. Hope this helps!

提交回复
热议问题