jQuery append DOM

前端 未结 1 1752
没有蜡笔的小新
没有蜡笔的小新 2020-12-19 04:10

All the examples of jQuery.append() seem to take an html string and append it to a container. I have a slightly different use case. My server returns me an XML that contains

相关标签:
1条回答
  • 2020-12-19 04:26

    You can't append nodes that belong to one DOM tree to another document.

    Try to clone them:

    $("#eventDiv").append( jData.find("contents").children().clone() );
    

    or simply use their textual representation to have them re-created:

    $("#eventDiv").append( jData.find("contents").html() );
    
    0 讨论(0)
提交回复
热议问题