问题
I am working on simple auto complete chrome extension using jQuery-textcomplete script.
It is working well on most of traditional sites, because they use textarea. It is not working on Google+ comment box, Facebook comment box and even gmail.
Because they only use div tag with HTML5 'contenteditable' option to get user's text, and also use react in facebook.
So jquery selector not working. How can I solve this problem? Here is my selector.
$("textarea, .editable, textbox, text").textcomplete([{
match: /(^|\S*)([^\u0000-\u007f]{2,}|\w{2,})$/,
search: function (term, callback) {
callback($.map(EnDict, function (word) {
return word.indexOf(uni_word) === 0 ? word : null;
}));
},
replace: function (word) {
return word + ' ';
}
}]);
There is Github Repository

来源:https://stackoverflow.com/questions/30221748/jquery-textcomplete-does-not-work-on-contenteditable-div-from-chrome-extension