JSFiddle - React, Tailwind, and code Playground

HTML

<button id="button1">Insert using $("#container").html()</button>
<button id="button2">Insert using document.getElementById(container).innerHTML</button>
<div id="container">
    
</div>

<div id="content">
    Some HTML
    <script>
        alert('Some script');
        $(function(){alert('READY')})</script>
</div>

CSS

#container{
    height:200px;
}

JavaScript

$(function(){
    
    var htmlToAdd = $("#content").html();

    $("#button1").on("click", function(){
        $("#container").html(htmlToAdd);
    });

    $("#button2").on("click", function(){
        document.getElementById("container").innerHTML = htmlToAdd;
    });
    
})