Hi,
I want to append the content of an already defined "old div" tag to the "new div" tag dynamically but as I'm new to javascript i don't have any idea that how to do this. The code i tried is attached below.
And one more question, how to remove that appended div tag dynamically?
Any help would be greatly appreciated.
Regards,
Mundvawala
<html>
<head>
<script type="text/javascript">
function add() {
var i = document.getElementById( 'old' );
var d = document.getElementById( 'new' );
d.appendChild( i );
}
</script>
</head>
<body>
<div id="old">
Content of old div
</div>
<div id="new">
</div>
<button onclick="add">Add</button>
</body>
</html>