views:

130

answers:

5

Hi,

I am trying to use a string that contains double quotes in the title attribute of an anchor. So far I tried these:

<a href=".." title="Some \"text\"">Some text</a>
<!-- title looks like `Some \` --!>

and

<a href=".." title="Some &quot;text&quot;">Some text</a>
<!-- title looks like `Some ` --!>

Please note that using single quotes is not an option.

Thanks a lot!

+2  A: 

Does &#34; instead of &quot; work?

fredley
+2  A: 

Give this a shot

HTML Escape character list.

It's a great reference for all of these characters.

Dave
+9  A: 

This variant -

<a href=".." title="Some &quot;text&quot;">Some text</a>

Is correct and it works as expected - you see normal quotes in rendered page.

Māris Kiseļovs
Yep. `<a href="#" title="Foo "Bar"">Testing</a>` and `<a href="#" title="Smart quotes ”Bar“">Testing too</a>` work for me.
Olly Hodgson
A: 
<a title="Some ""text""">
skyfoot
+1  A: 

Using &quot; is the way to do it, I tried you second code snippet and it works on both Firefox and IE.

TheCee