I have the following JQuery code:
$(this).text('Options ▴');
However, the ascii code isn't showing up on my web page. All that shows up is on the webpage is Options ▴
.
What am I doing wrong?
I have the following JQuery code:
$(this).text('Options ▴');
However, the ascii code isn't showing up on my web page. All that shows up is on the webpage is Options ▴
.
What am I doing wrong?
▴
is definitely not ascii (ascii's a character code that runs from 0 to 127...!-) -- it seems to be a high-page unicode character. What char encoding is your page using? With something "universal" like utf-8, unicode characters should show up... if the browser has them in its font, of course. With other encodings, such characters might just be impossible to transmit and show.
Use the .html()
method instead of .text()
.
The whole point of .text()
method is to make the text appear exactly as it's in the string, with all tags and entities.
If you use a unicode escape ('\u25B2') instead of the html escape character, you can use the .text method.
Some users will not have a font that will display either version.