Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display HTML special characters stored in JavaScript string

I need to dynamically append a text to a <div> with JavaScript. This text is retrieved from a database and it also contains special character as ü or '. Now i'm using the createTextNode() but the HTML special characters like &xxxx; aren't "resolved" then the output isn't correct.

Is there any method to print out the text with special character displayed correctly?

Thanks for any reply

like image 743
Michele Avatar asked Sep 05 '26 07:09

Michele


1 Answers

I think it will do exactly what you want if you use innerHTML instead of createTextNode().

like image 106
wwwmarty Avatar answered Sep 06 '26 20:09

wwwmarty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!