Alex Rivera | Logout

How can I escape a single quote?

Asked 2010-03-11T20:52:45.497
245

How can I escape a ' (single quote) in HTML?

This is where I'm trying to use it:

<input type='text' id='abc' value='hel'lo'>

The result for the above code is "hel" populated in the text box. I tried to replace ' with \', but this what I'm getting.

<input type='text' id='abc' value='hel\'lo'>

The result for the above code is "hel" populated in the text box.

How can I successfully escape the single quotes?

Edit
Report

1 Answer

-1

You could try using: &#145;

answered 2010-03-11T20:54:20.123

Your Answer