Insert html using jquery .html()

前端 未结 7 703
面向向阳花
面向向阳花 2021-02-08 15:58

I want to insert a large chunk of html into a pre-existing . I am using this method:

 $(\"td#content\").html(LOTS_OF_HTML_CODE_HERE);
         


        
7条回答
  •  说谎
    说谎 (楼主)
    2021-02-08 16:13

    You should probably be creating your elements with jquery, rather than in a big string. You get no certainty of dom correctness if you just use a big string, and it's near impossible to debug or modify.

    This is similar to building xml by hand. It's just not the preferred way of doing it.

提交回复
热议问题