var list =["<script></script>", "A", "B", "C"]
I got unexpected token ILLEGAL error here. Say, if I do want the script tag to be included, but just plain text, how can I format the list. Thanks!
var list =["<script></script>", "A", "B", "C"]
I got unexpected token ILLEGAL error here. Say, if I do want the script tag to be included, but just plain text, how can I format the list. Thanks!
If you are using an inline script1, then </script> will terminate the script element in the middle of the array constructor (all the HTML is parsed before the text nodes in the element are passed to the JS engine, </script> gets no special treatment for being inside a JS string literal).
Escape the /:
var list =["<script><\/script>", "A", "B", "C"]
You could also move the script to an external file and src it.
<script> element with the JS directly inside it as opposed to one with a src attribute or an intrinsic event attribute like onclick.Replace with
var list =["<script></"+"script>", "A", "B", "C"]
The "</script>" was ending the script element in which you have your script.
/.