Avant dans JavaScript

<button onclick="fun_name()">Insert</button>

<script>
 function fun_name()
 {
  var elem = document.getElementById("idDiv2");
  elem.before("New Content");
  
  var elem2 = document.getElementById("idDiv1");
  alert(elem2.outerHTML);      
 }
</script>
Filthy Flamingo