Home  >  Article  >  Web Front-end  >  Use Js to prevent special characters in Html from being escaped_javascript tips

Use Js to prevent special characters in Html from being escaped_javascript tips

WBOY
WBOYOriginal
2016-05-16 17:17:352264browse

For example: When there are similar escape characters between , they will always be parsed. However, all "&" can be replaced with "&" through the program, but some are originally " &" will also be converted, which is wrong. How can I display the text contained between intact?

Copy code The code is as follows:


<script> <br>document.getElementById('t').innerText='a<&>'; <br></script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn