append虛擬元素時
#newBlock
width: 100px
height: 100px
background: teal
const newBlock=document.createElement('div');
newBlock.id='newBlock';
document.appendChild(newBlock.cloneNode(true));
cloneNode代表無限複製,如果沒有用這個引數,他只會做出「搬移」(僅複製一次的效果)
append現有元素時
#nowBlock
hr
#newland
#nowBlock
width: 100px
height: 100px
background: teal
newLand.appendChild(nowBlock.cloneNode(true))