Following is my code where i use desc from autocomplete to fill into next element that is an hidden input box :
Check if this helps you in something
function getTage() {
var availableTags = [
{assign var=result_products_cnt value=1}
{foreach from=$result_products item=product}
{if $result_products_cnt eq $result_products_total}
{ label: "{$product.name}", value: "{$product.name}", desc: "{$product.id_product}" }
{else}
{ label: "{$product.name}", value: "{$product.name}", desc: "{$product.id_product}" },
{/if}
{assign var=result_products_cnt value=$result_products_cnt+1}
{/foreach}
];
return availableTags;
}
var availableTags = getTage();
$( "#nxpublisher_productid_"+i ).autocomplete({
source: availableTags,
select: function( event, ui ) {
$(this).next().val(ui.item.desc);
},
open: function() { $('.ui-menu').width(400); $('.ui-menu li a').css("font-weight", "bold"); $('.ui-menu li a').css("text-align", "left");}
});
nxpublisher_productid_ is one of the id of my multiple taxtboxes where i want to initiate autocomplete.
P.S i have used this function in smarty so please dont mind copying complete function.