Html Entities With Jquery
Solution 1:
val()
or value
sets a plain text value. …
is HTML, not text; you could use it in innerHTML
or .html()
, but not in a form field value.
If you want to include U+2026 HORIZONTAL ELLIPSIS in a JavaScript string where the encoding is not guaranteed, you could escape it to:
'Loading\u2026'
Should I enter the ellipsis directly from keybord in the code above? Is it safe with UTF-8?
Yes.
However, the ellipsis has a compatibility decomposition into three period characters; it is really only there for backwards compatibility with older character sets. These days the idea is just to use three periods, and let the font deal with coming up with combined glyphs if necessary. In any case, there is little to no visual difference between three periods and an ellipsis in most (proportional) fonts.
Solution 2:
Just as note, these are the useful spanish characters
\u00E1 á
\u00E9 é
\u00ED í
\u00F1 ñ
\u00F3 ó
\u00FA ú
\u00C1 Á
\u00C9 É
\u00CD Í
\u00D1 Ñ
\u00D3 Ó
\u00DA Ú
I've created a useful tool to convert whatever you want to the corresponding \uVALUE in JS :) http://jsfiddle.net/tomasdev/VjAkJ/
Post a Comment for "Html Entities With Jquery"