开发者

How to replace a Character in text By jquery

开发者 https://www.devze.com 2023-01-27 10:51 出处:网络
How to replace a charcter within a text For instance <script>alert(\"Hi i am nishant\");</script>开发者_C百科

How to replace a charcter within a text For instance

 <script>alert("Hi i am nishant");</script>开发者_C百科

here i want to replace < and > by ASCII code so how i will replace it.


var text = text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
0

精彩评论

暂无评论...
验证码 换一张
取 消