How to append a whole html file with jquery

后端 未结 2 1592
面向向阳花
面向向阳花 2021-01-26 17:48

I got a html file like this,


 
  
   //some content
  
  
   //some content
          


        
2条回答
  •  有刺的猬
    2021-01-26 18:44

    You can use element with rel attribute set to import, href set to path to file, type set to "text/html". Use XMLSerializer() instance .serializeToString() with replacement document .doctype property as parameter to get declaration from imported document; document.write() with .import.documentElement.outerHTML property of link element as parameter to replace existing .doctype and node with .doctype and of imported document.

    
     
      
       
      
      
       //original content
       
       
      
     

提交回复
热议问题