Hi,
I want to assign a block of html code to a js variable
the html code is
<script>alert('test');</script>
I want to do this
var script = "<script>alert('test');</script>";
document.getElementById('test').innerHTML = script;
but it does not work
if I substitute the tag (or any other tag) for the tag, then it works.
var script = "<span>alert('test');</span>";
I tried
var script = "<script>alert('test');</script>";
eval(script);
and
eval ("<span>alert('test');</span>");
but they both have syntax errors.
It probably has to do with have script tags inside of script tags
<script> <script> </script> </script>
Is there a way to get around this?
TIA