I’m using .innerHTML to write strings to an HTML page. I need to have things like < and > to print alongside < and > on the page. However, < consistently gets printed out as <. I’ve heard that I can do this if I write to the page as HTML rather than text, but I thought .innerHTML was doing that. Is there an escape character I can use or is there something I can do with JS to get this done?
I’m using .innerHTML to write strings to an HTML page. I need to have
Share
You need to write out
<as&lt;.