How can jQuery load some html and append it to the <body> element?

后端 未结 5 490
小蘑菇
小蘑菇 2020-12-10 10:37

I tried the following:

$.load(\"Views/chatBox.html\").appendTo(\'body\')

Console Output:

TypeError: $.load is not a functio         


        
5条回答
  •  南方客
    南方客 (楼主)
    2020-12-10 11:31

    When I tried out GaVrA's solution I found it could be even simpler:

    
    

    I guess appentTo automatically removes a previous instance? Perhaps I'm missing something here?

提交回复
热议问题