【问题标题】:How to use more than one jQuery AutoSuggest on a single page?如何在一个页面上使用多个 jQuery AutoSuggest?
【发布时间】:2011-07-03 11:48:42
【问题描述】:

感谢您的回复。所以我没有在我的问题上添加更多细节。现在我正在解释整个问题..

我在我的页面中创建了一个自动建议,现在我想在同一页面中再创建两个自动建议,这意味着一个页面中总共有三个自动建议。

我使用此语法在我的页面中创建自动建议。

$("input[type=text]").autoSuggest("http://mysite.com/path/to/script", {minChars: 2, matchCase: true});

但如果我将另外两个自动建议放在一个页面中,那么我将只获得第一个自动建议值。意味着我不知道在 jquery 中放入什么以及在 HTML 中放入什么。

你能给我一些简单的例子来在一个页面中创建三个自动建议..

非常感谢。

【问题讨论】:

    标签: jquery autocomplete autosuggest


    【解决方案1】:
    <input type="text" id="first" />
    <input type="text" id="second" />
    <input type="text" id="third" />
    
    
    $("#first").autoSuggest("http://mysite.com/path/to/script/first", {minChars: 2, matchCase: true});
    
    $("#second").autoSuggest("http://mysite.com/path/to/script/second", {minChars: 2, matchCase: true});
    
    $("#third").autoSuggest("http://mysite.com/path/to/script/third", {minChars: 2, matchCase: true});
    

    【讨论】:

    • 谢谢您的回复,但如何检索自动建议值...?
    猜你喜欢
    • 2015-09-30
    • 2014-01-25
    • 2021-03-26
    • 2012-07-30
    • 2012-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多