Tony
Tony

Reputation: 12695

JSON string to HTML

in my JSON string (from the server response) I have a HTML tags, eg abc<br/>dd. That string goes to the DOM element as its content.

How to display it as a proper HTML, instead of raw string ?

Upvotes: 0

Views: 135

Answers (1)

Adrian
Adrian

Reputation: 46423

You'll need to set it as the HTML rather than the text. Using DOM directly, you'd set element.innerHTML = myValue;. If you're using jQuery, you'd use $('#myElement').html(myValue);.

Upvotes: 1

Related Questions