I am having problem with tag once I want to intialize it into String. Before posting this question< I have looked several already asked questions regarding closing tag in string:
- The string "</script>" in an array is interpreted, is there a workaround?
- Why split the <script> tag when writing it with document.write()?
- Unexpected token ILLEGAL in javascript for array
But, in my case, I cannot slipt into two parts like:
var test = '...... </scr'+'ipt>......';
Because, I receive it from Backend directly as one variable, I want to do it in Frontend without touching representation of in Backend.
<body>
<p id="one">This is a text</p>
<script type="text/javascript">
var some = '<script>alert(\"from Learning objective title\")</script>';
document.getElementById("one").innerHTML = some;
</script>
</body>
I would appreciate any help. Thanks.