1

I am trying to read the html content using innerHTML. It seems to convert the '<' in the text content to '&lt;' .

I would rather not to. Is there anything in JS that would allow me to render as such

1 Answers1

1

Lodash supports an unescape() function that does this.

For example,

// This reads < as &lt;
let html = document.querySelector('.el').innerHTML
// This converts the &lt; back into <
html = _.unescape(html)

More answers are available in this question: Unescape HTML entities in JavaScript?

S Anand
  • 10,326
  • 1
  • 27
  • 21