Search code examples
htmltooltip

How to make tool tips with quotation marks inside in HTML?


The following piece of HTML code:

   <span title="Download this file to your computer">
   <a href="URL">
   <img src="SomeOtherURL" alt="Download" style="width:42px;height:22px;border:0">
   </a></span>

works fine unless my title has no quotation marks in it .

However, when it does:

<span title="Download "Shanghai Surprise" to your computer">
<a href="URL">
<img src="SomeOtherURL" alt="Download" style="width:42px;height:22px;border:0">
</a></span>

then everything collapses. Is there any way to do tool tips with quotation marks inside?


Solution

  • You need to use the HTML escape character instead:

    &#34;
    

    or

    &quot;
    

    example:

    &#34;word&#34; or  &quot;word&quot;
    

    FIDDLE