【问题标题】:Twitter Typeahead min length = 0 equivalent?Twitter Typeahead 最小长度 = 0 等效项?
【发布时间】:2013-07-02 23:21:42
【问题描述】:

我正在使用Twitter's Typeahead.js (Not the one included in Bootstrap),我想知道Better-Typeahead (Bootstrap) 中是否存在与 minLength=0 类似的函数

Triggering on input looked promising,但我不希望触发下拉时输入框中有任何文本。

【问题讨论】:

    标签: javascript jquery twitter typeahead.js


    【解决方案1】:

    是的,数据集有一个minLength 选项,请参阅代码here。它已经在 since v0.9.1 附近,但还没有进入自述文件。

    以下是您的使用方法:

    $('.typeahead').typeahead({
      minLength: 3,
      local: [/* ... */]
    });
    

    【讨论】:

    • 谢谢!为了提高工作效率,我暂时不再使用 Twitter Typeahead,但我以后会试试这个
    • 我设置如下: $('.typeahead').typeahead(null, { minLength: 3, displayKey: 'value', source: geoLocation.ttAdapter() });但仍然在第一次输入时提出请求
    猜你喜欢
    • 1970-01-01
    • 2014-08-26
    • 2021-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-31
    相关资源
    最近更新 更多