Appending multiple html elements using Jquery

后端 未结 5 2075
醉话见心
醉话见心 2021-02-08 02:10

Am new to jQuery and wondering if any could advise me on best practise...

I am looking to append a div element to the page, which contains a lot of html and not sure wha

5条回答
  •  野的像风
    2021-02-08 02:47

    Currently there are following methods:

    1. Use "+" to join HTML code pieces.

    2. Use "\" to escape.

    3. Use "`" (back-tick, grave accent), do not need any extra operations. This method is supported from ES2015/ES6 (Template literals).

    4. Add a hidden tag containing the same HTML code you need, e.g.

      Now post some use scenarios to the first three methods metioned above (just run them in the console of Chrome browser.):

    We can see their differences clearly.

提交回复
热议问题