Forum Moderators: open

Message Too Old, No Replies

escaping quotes in text box

         

Lisa

5:52 am on Oct 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<td><input type='text' name='mybox' value='Lisa's stuff' size='35'></td>

How does one escape the single quote if using single quotes in HTML?

MonkeeSage

6:07 am on Oct 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use double-quotes to surround the attribute values and you won't need to escape it. But if you have to, I think it's just the standard escape '\'...'Lisa\'s stuff'

Jordan

Lisa

6:24 am on Oct 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok, the \ excape doesn't work. That is the first thing I tried.
If I do change to double quotes..... How do I escape double quotes then?

<td><input type="text" name="mybox" value="Lisa "my" stuff" size="35"></td>

Lisa

6:31 am on Oct 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



AH! I figured it out...

<td><input type="text" name="mybox" value="Lisa &quot;my&quot; stuff" size="35"></td>

I should have figured that out.

MonkeeSage

6:45 am on Oct 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Smart thinking. :)

Can also use &#34; (same as &quot; HTML) for XML, and &apos; / &#39; for single-quotes.

Jordan