JSFiddle - React, Tailwind, and code Playground
HTML
<div id="main">
<div id="updateable">
</div>
<button id="run">Run Me</button>
</div>
CSS
#main{
width:500px;
height:800px;
background:palegoldenrod;
}
#text{
width:150px;
height:200px;
}
#updateable{
width:250px;
height:400px;
background:white;
}
JavaScript
document.getElementById("run").onclick=function(){
var x = document.getElementById('updateable');
var html= "<p>Hello World</p>";
var css="<style>p {color:green;}</style>";
var js="<script> alert('hello world') <\/script>";
x.innerHTML=html + css +js;
}
/*
document.getElementById("run").onclick=function(){
var x = document.getElementById("text").value;
document.getElementById("updateable").innerHTML=<script> alert('hello world') <\/script>*/