Jquery inserting unicode instead of symbol

℡╲_俬逩灬. 提交于 2021-02-16 16:12:47

问题


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:


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



来源:https://stackoverflow.com/questions/10558911/jquery-inserting-unicode-instead-of-symbol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!