8

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/

1 Answer 1

10
+50

♂ 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)

3
  • That was fast and thanks a lot ! Any idea for the second problem ?
    – francoboy7
    May 11, 2012 at 21:35
  • stackoverflow.com/questions/2920150/…
    – SLaks
    May 11, 2012 at 21:37
  • 2
    I can't believe how many question there are at SO about this matter. While many of the answers allude to the same issues, your answer was really the clearest, most concise, and intuitive out of all of them.
    – Scott
    Feb 18, 2016 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.