Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery inserting unicode instead of symbol

i'm looking in a way to make a really basic wysiwyg such as when a user lick the button, it insert the symbol ♂ (♂)

It is working but there is two problem : 1 - Only the unicode characters are inserted, they are not converted into symbol (♂)

2- If you have time, is there a simple way to insert the symbol where the "text cursor"is and not at the end of the content of the textarea ?

Thanks for your help

http://jsfiddle.net/cdjEr/3/

like image 370
francoboy7 Avatar asked May 11 '12 21:05

francoboy7


1 Answers

♂ is an HTML escape code.
It is only processed in HTML source.

Javascript string literals use their own escape code: '\u2642' (with the code point in hexadecimal rather than decimal).
You can also just use the character directly: '♂'. (this requires that you set your file encodings correctly)

like image 137
SLaks Avatar answered Oct 16 '22 04:10

SLaks