Reputation: 6103
How to replace a charcter within a text For instance
<script>alert("Hi i am nishant");</script>
here i want to replace < and > by ASCII code so how i will replace it.
Upvotes: 5
Views: 1308
Reputation: 45578
var text = text.replace(/</g, "<").replace(/>/g, ">");
Upvotes: 6