Javascript DOM tree duplicate for manipulation

后端 未结 3 658
旧时难觅i
旧时难觅i 2021-01-05 23:42

Since the DOM tree of a page is active and always reflected in the browser, what is the best way to modify this DOM tree for some purpose without affecting the actual render

3条回答
  •  太阳男子
    2021-01-06 00:05

    If you are willing to use jQuery:

    var clone = $("selectorForSomeElement(s)").clone();
    

    clone now is a copy of the element structure.

    You can then work off of clone to do whatever experimenting you like.

提交回复
热议问题