开发者

How can I retrieve two values from jquery-autocomplete

I need my application to auto-complete on a company name, but also fill in a hidden form field with the ID of that company selected.

I believe it's possible to return pair values, with the pipe separator, such as........

Microsoft|10
Orac开发者_开发知识库le|20
Sybase|30

And indeed this seems to work, but I don't know how to access the 2nd argument.


Everything should be returned within your select function. Your select function should be similar to this:

function autoCompleteSelected(event, item, formatted) 
{
   item[0]; // Should be Microsoft
   item[1]; // Should be 10;
}

Then to specify the select function:

$("#autoCompleteField").autocomplete(url).result("autoCompleteSelected");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜