javascript: alt attribute with special characters
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2775328/alt-attribute-encoding-with-javascript">Alt attribute encoding with JavaScript</a>  </p>
</blockquote>



<p>I can't seem to assign special characters using javascript in alt tags and have them render in any browser.</p>

<p>Without javascript, special characters in alt tags render fine (Pepsi&trade;):</p>

<p><code>&lt;img id="pic" src="path/to/image.jpg" alt="Pepsi&amp;trade;" /&gt;</code></p>

<p>However, when assigning this same value via javascript or jquery you get (Coke<code>&amp;trade;</code>).</p>

<p><code>$("#pic").attr("alt","Coke&amp;trade;")</code> or <code>image = document.getElementById('pic'); image.alt="Pepsi&amp;trade;"</code></p>

<p>This issue exists in chrome and IE6; I haven't tried other browsers. Any ideas?</p>
