string having '<br/>' throws unterminated string literal js error.
- by kranthi
Hi All,
I am fetching some data from Db and displaying it in a textarea using jquery in the following way.
$('#textareatest').val('<% =teststring %>').It is possible that the string 'teststring' can contain XHTML line breaks(<br/>).whenever the string contains <br/> I am getting the 'unterminated string literal' error.I saw a number of posts considering '\n' as line breaks and suggesting to escape it.I tried to escape the <br/> similarly,but it didn't work.
Could someone please help me with this?
UPDATE:: I've already escaped single quotes.
here is an example string test string<br />
Thanks.