【问题标题】:How to implement autocomplete for the following scenario如何为以下场景实现自动完成
【发布时间】:2014-04-08 01:58:50
【问题描述】:

我正在为以下场景寻找auto complete 解决方案:

我的页面有一个dropdownlisttextbox

   <table>
    <tr>
    <td>
        <asp:DropDownList ID="ddlRegions" runat="server"></asp:DropDownList> 
    </td>
    <td>
        <label>Enter Iso:</label>
        <asp:TextBox ID="txtIso" runat="server"></asp:TextBox>
    </td>
    <td>
    </tr>
    </table>

在输入 4 个字符后,我需要为我的 textbox 实现 autocomplete 未来。 文本框需要根据从dropdownlist 中选择的选项显示一些数据。

textbox 中输入值时,我需要显示不超过 10 个选项

我想我需要使用jqueryajaxwebservice 调用。

我怎样才能完成这样的事情?

谢谢

【问题讨论】:

  • jquery-ui 自动完成?
  • 我是新手,所以我不确定 jquery-ui 和其他的有什么区别

标签: javascript jquery ajax autocomplete


【解决方案1】:

只需从如下所示的链接下载 typeahead.js 并将其包含在您的应用程序中: http://twitter.github.io/typeahead.js/examples/ 此外,您必须包含 jQuery。

【讨论】:

  • 谢谢,我会这样做,但我应该如何使用它在输入 4 个字符后才开始显示一些数据并且只显示 10 个匹配项?
  • 好的,在Plunker Link为你创建了一个plunker你可以设置minLength值为4,在4个字符后开始搜索。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-06-23
  • 2021-12-18
  • 2012-12-02
  • 1970-01-01
  • 2019-09-01
相关资源
最近更新 更多