-1

I'm trying to generate this output using javascript.

</script>

I use -

var x = "</script>";
document.getElementById("someinput").value = x 

This code works well on normal coding platforms however blogger takes it differently. It takes the above code as following -

&quot;&lt;/script&gt;&quot;

And because of this the code stops working.

I heard something about escape characters in regex and I used that in this case like this -

var x = "<\/script>";
document.getElementById("someinput").value = x  

Though this may produce different output in other places, blogger produces this output -

</script>

I want to know more about this. Can anyone explain me in detail how does this process work overall. Thank you.

Kraken
  • 59
  • 7

0 Answers0