javascript get content of div

Solutions on MaxInterview for javascript get content of div by the best coders in the world

showing results for - "javascript get content of div"
Abigael
22 Mar 2017
1<body>
2<div id="DIV1">
3 // Some content goes here.
4</div>
5
6<div id="DIV2">
7</div>
8<script type="text/javascript">
9
10   var MyDiv1 = document.getElementById('DIV1');
11   var MyDiv2 = document.getElementById('DIV2');
12   MyDiv2.innerHTML = MyDiv1.innerHTML;
13
14</script>
15</body>
16