PHP get contents of a div, and echo the div contents in same page

This is how you can do it in javascript:

<script>
(function(){
     var divContent= document.getElementById("text-1").html(); //get div content

     document.getElementsByTagName("body").append(divContent); //add it to the body
})();
</script>

Leave a Comment