gpt4 book ai didi

php - 如何制作可搜索的下拉菜单

转载 作者:行者123 更新时间:2023-11-29 06:27:54 26 4
gpt4 key购买 nike

我想创建一个下拉菜单,您还可以在其中搜索选项。

我需要一个 dropdown 在我加载页面时从我的 DB 获取信息。然后我可以像往常一样点击下拉菜单并查看它的内容(比方说:Facebook 或 Google)。

我也可以在其中搜索,所以在我点击查看内容的顶部,我可以输入“Fa”,然后它会显示其中有“Fa”的内容,(在此示例仅限 Facebook)。

我不知道从哪里开始做这个。我正在寻找有关查看位置、如何制作、链接到示例等的一些指点。

最佳答案

来自 Satya's comment

实际上有一个 jQuery plugin这样做,有一组很好的配置选项:

$(document).ready(function() {
$("select").searchable({
maxListSize: 100, // if list size are less than maxListSize, show them all
maxMultiMatch: 50, // how many matching entries should be displayed
exactMatch: false, // Exact matching on search
wildcards: true, // Support for wildcard characters (*, ?)
ignoreCase: true, // Ignore case sensitivity
latency: 200, // how many millis to wait until starting search
warnMultiMatch: 'top {0} matches ...', // string to append to a list of entries cut short by maxMultiMatch
warnNoMatch: 'no matches ...', // string to show in the list when no entries match
zIndex: 'auto' // zIndex for elements generated by this plugin
});
});

这是一个 example

关于php - 如何制作可搜索的下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29841788/

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