How to highlight input words in autocomplete jquery ui

后端 未结 6 2184
后悔当初
后悔当初 2020-12-25 13:46

Could you please help me in highlighting the typed words in the auto complete text box. i am already populating the autocomplete words and i need to just highlight the typed

6条回答
  •  死守一世寂寞
    2020-12-25 14:23

    $.ui.autocomplete.prototype._renderItem = function (ul, item) {
    item.label = item.label.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(this.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1");
        return $("
  • ") .data("item.autocomplete", item) .append("" + item.label + "") .appendTo(ul); };

    Use this

提交回复
热议问题