Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

Possible Duplicate:
Alt attribute encoding with JavaScript Alt attribute encoding with JavaScript

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

Without javascript, special characters in alt tags render fine (PepsiTM):

<img id="pic" src="path/to/image.jpg" alt="Pepsi&trade;" />

However, when assigning this same value via javascript or jquery you get (Coke&trade;).

$("#pic").attr("alt","Coke&trade;") or image = document.getElementById('pic'); image.alt="Pepsi&trade;"

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

Possible Duplicate:
Alt attribute encoding with JavaScript

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

Without javascript, special characters in alt tags render fine (PepsiTM):

<img id="pic" src="path/to/image.jpg" alt="Pepsi&trade;" />

However, when assigning this same value via javascript or jquery you get (Coke&trade;).

$("#pic").attr("alt","Coke&trade;") or image = document.getElementById('pic'); image.alt="Pepsi&trade;"

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

Possible Duplicate:
Alt attribute encoding with JavaScript

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

Without javascript, special characters in alt tags render fine (PepsiTM):

<img id="pic" src="path/to/image.jpg" alt="Pepsi&trade;" />

However, when assigning this same value via javascript or jquery you get (Coke&trade;).

$("#pic").attr("alt","Coke&trade;") or image = document.getElementById('pic'); image.alt="Pepsi&trade;"

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

insert duplicate link
Source Link

Possible Duplicate:
Alt attribute encoding with JavaScript

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

Without javascript, special characters in alt tags render fine (PepsiTM):

<img id="pic" src="path/to/image.jpg" alt="Pepsi&trade;" />

However, when assigning this same value via javascript or jquery you get (Coke&trade;).

$("#pic").attr("alt","Coke&trade;") or image = document.getElementById('pic'); image.alt="Pepsi&trade;"

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

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

Without javascript, special characters in alt tags render fine (PepsiTM):

<img id="pic" src="path/to/image.jpg" alt="Pepsi&trade;" />

However, when assigning this same value via javascript or jquery you get (Coke&trade;).

$("#pic").attr("alt","Coke&trade;") or image = document.getElementById('pic'); image.alt="Pepsi&trade;"

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

Possible Duplicate:
Alt attribute encoding with JavaScript

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

Without javascript, special characters in alt tags render fine (PepsiTM):

<img id="pic" src="path/to/image.jpg" alt="Pepsi&trade;" />

However, when assigning this same value via javascript or jquery you get (Coke&trade;).

$("#pic").attr("alt","Coke&trade;") or image = document.getElementById('pic'); image.alt="Pepsi&trade;"

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

Post Closed as "exact duplicate" by Marcel Korpel, user229044 , kennytm, McDowell, Graviton
Source Link

javascript: alt attribute with special characters

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

Without javascript, special characters in alt tags render fine (PepsiTM):

<img id="pic" src="path/to/image.jpg" alt="Pepsi&trade;" />

However, when assigning this same value via javascript or jquery you get (Coke&trade;).

$("#pic").attr("alt","Coke&trade;") or image = document.getElementById('pic'); image.alt="Pepsi&trade;"

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

lang-js

AltStyle によって変換されたページ (->オリジナル) /