Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 73964

show html tags in html content, show html code snippet in html

$
0
0

I was wondering if there is a way I could apply htmlentities() to var x so that if I put <p>hello</p> into the text area and press the button it would display <p>hello</p> instead of hello using the below code.

Thanks in advance

function myFunction1() {
  var x = document.getElementById("myText1").value;
  document.getElementById("demo1").innerHTML = x;
}
<textarea name="myText" id="myText1" type="text"></textarea><button onclick="myFunction1()">thing</button><p><span id="demo1"></span></p>

Viewing all articles
Browse latest Browse all 73964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>