Skip to content

Commit a60e9b2

Browse files
Update script.js
Co-Authored-By: JehanKandy <jehankandy@gmail.com>
1 parent fc3d4fc commit a60e9b2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

js/script.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
function runCode(){
2-
const codeHtml = document.getElementById('for-html');
3-
const codeCss = document.getElementById('for-css');
4-
const codeJS = document.getElementById('for-js');
2+
const codeHtml = document.getElementById('for-html').value;
3+
const codeCss = document.getElementById('for-css').value;
4+
const codeJS = document.getElementById('for-js').value;
55
const codeResult = document.getElementById('result-code');
6+
7+
codeResult.contentDocument.body.innerHTML = codeHtml+"<style>"+codeCss+"</style>";
8+
codeResult.contentWindow.eval(codeJS);
69

710
}

0 commit comments

Comments
 (0)