2
是否有可能添加一些HTML jQuery自动完成UI项目? 例如,我想将<strong></strong>
标记添加到自动填充结果项目label: item['name']
。我试过做label: '<strong>'+item['name']+'</strong>
,但它是作为文本而不是HTML应用的。如何将自定义HTML添加到jQuery自动完成项目?
$('input[name="customer"]').catcomplete({
delay: 0,
source: function(request, response) {
$.ajax({
url: 'index.php?route=sale/customer/autocompletefilter_name=' + encodeURIComponent(request.term),
dataType: 'json',
success: function(json) {
response($.map(json, function(item) {
return {
category: item['customer_group'],
label: item['name'],
customer : item['name'],
value: item['customer_id'],
customer_group_id: item['customer_group_id'],
firstname: item['firstname'],
lastname: item['lastname'],
email: item['email'],
telephone: item['telephone'],
fax: item['fax'],
address: item['address']
}
}));
}
});
},
select: function(event, ui) {
//some actions on select
}
});
Thnak you。
请注意,此解决方案不适用'.catcomplete' – Kirzilla 2012-07-08 13:58:46
此回购出 – 2013-08-20 18:47:04