1
I have a variable you can store plain text and the tags <script>
and <img>
, delimited by (';')
. To separate the information, I use the method split(';')
. Works well for texts and <img>
, however, with <script>
makes a mistake (SyntaxError: unterminated string literal
), I imagine due to the various dots and commas within it. I would like a solution that would work so much to text and <img>
, how much to <script>
.
var test = 'texto1; texto2'; // Sem problema
var test = '<img src="imagem.jpg" />; <img src="imagem2.jpg" />'; // Sem problema
var test = '<script type="text/javascript">var a = "valor1";</script>; <script type="text/javascript">var b = "valor2";</script>'; // Com problema
console.log(test.split(';'));
How to form the plural of the word semicolon? :)
– Zuul