jQuery javascript 自动完成和管理 ids
我正在使用 jQuery UI 自动完成,现在在隐藏字段中我试图管理所选项目,
例如,考虑这是我拥有的数据集,[Apple:1, Mango:2, Coconut:3, Apple:4]
现在,如果我输入 hello
它应该打印 hello
现在到隐藏字段如果我触发自动完成并从隐藏字段中选择 Apple 应该是 hello [Apple:1]
到目前为止一切都很好,但是如果我从 apple
e > 主文本框中的隐藏字段应包含 hello appl
,它还应该允许有多个具有相同名称的条目(如此处所示,有 2 个 apple
条目)
I am using jQuery UI autocomplete, Now in the hidden field I am trying to manage the ids of the item selected,
For example, consider this is the data set I have, [Apple:1, Mango:2, Coconut:3, Apple:4]
Now if I type hello
it should print hello
to hidden field now if I trigger autocomplete and select Apple from it hidden field should be hello [Apple:1]
So far all good, but if I delete e
from apple
from the main textbox hidden field should holdhello appl
, It should also allow to have multiple entries with same name (as shown here with 2 entries of apple
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用地图数据结构管理它,因此如果我选择
abc
我会将其添加到地图{abc, 1}
现在更改时我将按空格分割它,我看到如果该单词属于映射,如果是,则将其替换为它的值I managed it with a map data structure so if I select
abc
I will add it into map{abc, 1}
now on change I am splitting it by space and I see if the word belongs to map if yes then replace it with its value