问题
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