I have made a code editor works well with js html and css. The out put is also given out automatically inside an iframe. but I want this output inside a div because I also want to drag and drop some elements inside the output section. Here's my code
<script type="text/javascript">
function run() {
let htmlCode = document.querySelector(".editor #html-code").value;
let cssCode = "<style>" + document.querySelector(".editor #css-code").value + "</style>";
let jsCode = document.querySelector(".editor #js-code").value;
let output = document.querySelector(".editor #output");
// html css runner
output.contentDocument.body.innerHTML = htmlCode + cssCode;
// java runner
output.contentWindow.eval(jsCode);
}
document.querySelector(".editor #html-code").addEventListener("keyup", run);
document.querySelector(".editor #css-code").addEventListener("keyup", run);
document.querySelector(".editor #js-code").addEventListener("keyup", run);
require pure js