jQuery UI 自动完成:使用选项卡滚动建议菜单

发布于 2024-10-07 17:38:21 字数 356 浏览 0 评论 0原文

当用户按下 Tab 键(并且同时在搜索字段中)时,我想滚动浏览 jQuery UI 自动完成建议。

我相信我的问题的答案与已经提出的问题的答案密切相关 这里

$("#search").keypress(function (eventObject) {
   if (eventObject.keyCode==13){
      *what do I write here*
   };
};

I would like to scroll through the jQuery UI autocomplete suggestions when the user presses the tab key (and is simultaneously in the search field).

I believe that the answer to my question is closely related to the answer to the question already asked here.

$("#search").keypress(function (eventObject) {
   if (eventObject.keyCode==13){
      *what do I write here*
   };
};

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅语花开 2024-10-14 17:38:21

如果我正确理解您的要求,那么我认为 jQuery UI 自动完成不支持确切的场景。当您按下 Tab 时,您可以打开自动完成下拉列表,然后使用箭头键在项目列表中移动。

// Setup
$("#search").autocomplete({
    minLength: 0,
    source: myItems
});

// Call on tab press
$("#search").autocomplete("search", "");

If I correctly understand your requirement then I don't think that exact scenario is supported with jQuery UI autocomplete. You can open the autocomplete drop down when you press tab and then use the arrow keys to move through the list of items.

// Setup
$("#search").autocomplete({
    minLength: 0,
    source: myItems
});

// Call on tab press
$("#search").autocomplete("search", "");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文