jQuery(function() {
var ingrident_array_json = [{"id_product":"45","name":"Acetyl Hexapeptide-8\ufeff (Argireline)","unit_price":"19.4500000000","usage_percent_lo":"3.00","usage_percent_hi":"10.00","usage_percent_best":"10.00"},{"id_product":"46","name":"Ceramide Complex (CeraTouch\u2122)","unit_price":"23.6125000000","usage_percent_lo":"3.00","usage_percent_hi":"10.00","usage_percent_best":"5.00"}];
$("input:text[id^='ingredient']").live("focus.autocomplete", null, function () {
$(this).autocomplete({
autoFocus: true,
source: projects,
focus: function( event, ui ) {
$( "#autocomplete" ).val( ui.item.name );
return false;
},
select: function( event, ui ) {
$(this).val( ui.item.name );
$(this).attr("data-value",ui.item.unit_price);
$(this).closest('.extra_fileds').find('.product_id_public').val(ui.item.unit_price);
return false;
}
})
});
});
我有 ingrident_array_json json 数组,它在每条记录中有六个元素,我希望在自动完成填充中命名,在隐藏字段中添加它们的其他记录。可能吗?现在什么都没有显示。请任何帮助将不胜感激