before in javascript

Solutions on MaxInterview for before in javascript by the best coders in the world

showing results for - "before in javascript"
Louis
04 Apr 2019
1<button onclick="fun_name()">Insert</button>
2
3<script>
4 function fun_name()
5 {
6  var elem = document.getElementById("idDiv2");
7  elem.before("New Content");
8  
9  var elem2 = document.getElementById("idDiv1");
10  alert(elem2.outerHTML);      
11 }
12</script>