gpt4 book ai didi

javascript - 如何更新 bootstrap-typeahead.js 中的源选项

转载 作者:数据小太阳 更新时间:2023-10-29 03:58:48 25 4
gpt4 key购买 nike

我正在使用 bootstrap-typeahead 以允许多项选择。这是 demo .

原始代码已由@Sherbrow 更新 Twitter bootstrap typeahead multiple values

我的问题与以下用例有关:
插入 Alaska 值后,我想更新不再显示 Alaska 值的源。
有什么提示吗?

最佳答案

我遇到了同样的问题,这个会为你节省很多时间。我已经更新了你的旧 jsFiddle用我的代码示例。基本的事情是你需要做的

var autocomplete = $('input').typeahead();
autocomplete.data('typeahead').source = newSource;

其中 newSource 是新数组。现在您只需要一个添加或删除元素的函数,或者您需要用它做的任何事情。

关于javascript - 如何更新 bootstrap-typeahead.js 中的源选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13516396/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com