I am making a code editor similar to Codepen, however when I try to make my Javascript textarea to say </script>
, it will think I want to end the script of the actual program.
<script>
function compile() {
var html = document.getElementById("html");
var css = document.getElementById("css");
var js = document.getElementById("js");
var code = document.getElementById("code").contentWindow.document;
submit = () => {
code.open();
code.writeln(
html.value +
"<style>" +
css.value +
"</style>" +
"<script>" +
js.value +
"</script>"
);
code.close();
};
}
compile();
</script>
I understand this could be easily fixed by instead making this a separate .js file, but I want to know how to put this script in an HTML file without it thinking "" is to end the actual html files script.
Thank you in advance