JavaScript Appending another Div data on Div Tag Dynamically

前端 未结 2 1344
渐次进展
渐次进展 2021-02-01 11:47

I want to append the content of an already defined \"old div\" tag to the \"new div\" tag dynamically but its not working. The code i tried is attached below. And one more quest

2条回答
  •  滥情空心
    2021-02-01 11:59

    Try this

    var i = document.getElementById( 'old' );
    var d = document.getElementById( 'new' );
    d.innerHTML += i.innerHTML;
    

提交回复
热议问题