jQuery 自动完成类别选择标签和值 [英] jQuery Autocomplete Categories Select Label and Value

查看:27
本文介绍了jQuery 自动完成类别选择标签和值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用带有类别的 jQuery 自动完成功能将选定的值返回到搜索字段,并将该值返回到单独的输入字段.

Trying to get the jQuery Autocomplete with categories to return the selected value to the search field and the value to a separate input field.

我已将数据修改为具有值以及标签和类别.

I have modified the data to have a value as well as label and category.

http://jsfiddle.net/chrisk/bM7ck/

但值总是返回到搜索字段而不是标签.

But the value is always returned to the search field instead of the label.

推荐答案

这就是当您同时提供标签和值时 jquery ui 自动完成的工作方式.如果您希望标签返回到搜索字段,则重命名值字段.

That's how the jquery ui autocomplete works when you supply both a label and a value. If you want the label returned to the search field, then rename the value field.

更新小提琴:http://jsfiddle.net/jensbits/bM7ck/3/

这篇关于jQuery 自动完成类别选择标签和值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆