Closed amitava82 closed 11 years ago
You need to add the description as a data-element when it's being constructed in the displayOptionList() function first:
matchesList += "<li data-value='" + matches[i].key + "' data-description='" + matches[i].description + "'>" + matches[i].key.replace(highlightRegex, "$1") + " " + matches[i].description + "</li>";
Then later down in the code in the selectOption() function, you can choose to set current to data-description
instead of data-value
Or you could go a step further, and add an param called "selected" or something and default it to "value".
Next, in the selectOption() function, you would change data-value
to "data-" + autocomplete_data.selected
.
Then, in your tinymce init, add the option of autocomplete_selected : "description",
OK, thanks! I'll try it out.
I want autocomplete to match key but insert description on select. { "key": "Kattila", "description": "/ The Great Bum" }