Use Js to keep special characters in Html unescaped

  • 2020-03-26 23:04:42
  • OfStack

For example: < Textarea> < / textarea> It is possible to replace all ampersand with ampersand by a program, but some of the ampersand will be converted, which is a mistake. How to make < Textarea> < / textarea> What if the text contained between them is displayed intact?

<textarea id="t" rows="20"cols="20"></textarea>  
<script>  
document.getElementById('t').innerText='a<&>';  
</script> 

Related articles: