0

I have a editable textbox. If I will enter alert('Hi'); , then it saves properly. After saving it will forward to a list page where that text box value will be a hyperlink. If we click on that hyperlink then alert displays. But we want to escape this. Can any one have the resolution for this ? Thanks in advance

2
  • Try encodeURIComponent and find its encodeRFC5987ValueChars example. Commented Jun 23, 2015 at 7:35
  • Lets say I have a text box. <input type="text" name="studentName"> . When I will enter some text " <script> alert('Hi');</script> " . then it behaves like a javascript. Hence it alert comes up onload of the page Commented Jun 23, 2015 at 7:37

1 Answer 1

1

Before the text is saved for further processing or display, replace all "<" by "&lt;" and replace all ">" by "&gt;"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.