0
私はこれを検索しましたが、私が作業しているコードでうまく動作するようになっています。jQuery UIのオートコンプリートの結果の太字は
オートコンプリートの結果内で入力が太字になりたい場合は、誰でも手伝ってください。私は、このメソッドを使用しようとしました
jQuery('#description-input:not(.ui-autocomplete-input)').live('focus', jQuery.proxy(function(event){
jQuery(event.target).trigger(this.config.events.AUTORESIZE).autocomplete({
source: jQuery.proxy(function(request, response) {
jQuery.ajax({
url: self.config.keyword_search_url,
dataType: "json",
data: { name_startsWith: request.q, q : jQuery('#description-input').val(),
level: this.selectedStore.getLevelId() },
select: function(event, ui) { event.stopPropagation(); },
success: function(data) {
response(jQuery.map(data, function(item) {
return { value: item };
}));
}
});
}, this),
focus : jQuery.proxy(function(event, ui) {
jQuery('body').undelegate('#description-input', 'blur');
jQuery('ul.ui-autocomplete').one('mouseleave', jQuery.proxy(function(event) {
jQuery('body').delegate('#description-input', 'blur', jQuery.proxy(function(event) {
self.exitEditItem(event);
}, this));
}, this));
}, this),
select : jQuery.proxy(function(event, ui) {
event.ui = ui;
self.editItemSpecialKeys(event);
jQuery('ul.ui-autocomplete').unbind('mouseleave');
jQuery('body').delegate('#description-input', 'blur', jQuery.proxy(function(event) {
self.exitEditItem(event);
}, this));
}, this),
position : {
my: 'center top',
at: 'center bottom',
offset: '0 -1px',
collision: 'flip'
},
delay: 0,
minLength: 2,
disabled: true
}).autocomplete('widget').addClass('autocomplete-list');
ありがとう:
function __highlight(s, t) {
var matcher = new RegExp("("+$.ui.autocomplete.escapeRegex(t)+")", "ig");
return s.replace(matcher, "$1");
}
が、私は運を取得していないのです。
待機。私はここにコードやリンクを入れます。 _renderItem::機能(UL、アイテム){ \t \tリターン$( "
") \t \t \t .dataセクション( "item.autocomplete"、項目) \t \t \t .append($ juery UI自動補完で – Thulasiram( "").text(item.label) \t \t \t .appendTo(ul); \t}、それは正常に動作します($( "")の.html(item.label)) – Thulasiram
instend($( "")は.text(item.label)) 。 – Thulasiram