No. You can’t. HTML is not Javascript (obviously). Any raw html inside a <script>
block is simply a syntax error:
<script>
<div>Hi mom!</div> // <-- javascript syntax error
var foo = '<div>Hi mom!</div>'; // valid javascript.
</script>
The second one works because it’s NOT Html. It’s a javascript string that contains some characters that LOOK like html.
The only HTML-ism that’s valid inside javascript is the comment opener, <!--
, which is supported only for historical reasons (to hide JS from browsers which didn’t understand/support the <script>
tag).