jquery Auto-complete loads ASCII HTML Character Codes in to the Text Area

我是研究僧i 提交于 2020-01-25 11:28:48

问题


I am using jQuery AutoComplete plugin.

I have the data which has special characters as '/-&

When user clicks the text area, the autocomplete drop down shows the data correctly for example:

don't drink

When user selects the text (don't drink)

In my textarea it load the value as ASCII characters:

don't drink

How can I have the data to load as normal data.

This is my autocomplete code:

 var directions ="don't drink/ Once a Day/ Take More/ You'are Good";
 directions = directions.split("/");
 $("#TextArea").autocomplete(directions, {
                matchContains: true,
                minChars: 1
            });

回答1:


You can add formatResult to your autocomplete options specifying a function that decodes the result that's output to the text box.



来源:https://stackoverflow.com/questions/8509474/jquery-auto-complete-loads-ascii-html-character-codes-in-to-the-text-area

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