JQuery загружается в iframe
Я создал редактор страниц, такой как Codepen, но проблема в том, что файл jQuery не загружен и не будет выполнен. мой код следующий, как я могу добавить JQuery к этому коду?
<div class="live-room">
<iframe id="live" src=""></iframe>
</div>
....
<script>
/**** Messy Code That Sends The Updated** Code From The Editors To The** Iframe*/
const liveRoom = document.getElementById('live');
liveRoom.contentWindow.document.body.innerHTML = '<h1>Hello World!</h1><script src="https://oooo.com/js/jquery.js"/>';
const style = document.createElement('style');
style.setAttribute('id', 'style');
style.innerHTML = 'body {color: red;}'
const script = document.createElement('script');
script.innerHTML ='console.log("hi")';
liveRoom.contentWindow.document.head.appendChild(style);
liveRoom.contentWindow.document.head.appendChild(script);
CodeMirror.on(studio.editor.html, 'change', function () {
liveRoom.contentWindow.document.body.innerHTML = studio.editor.html.getValue();
})
CodeMirror.on(studio.editor.css, 'change', function () {
liveRoom.contentWindow.document.getElementById('style').innerHTML = studio.editor.css.getValue();
})
</script>
Я действительно запутался, пожалуйста, опишите правильный код для меня.