类似于CTRL + F功能的搜索框


Search box that is similar to CTRL + F function

我想创建一个类似于Ctrl+F的搜索框,但只查找某些内容。

当你在"跳转到:"框中输入一些东西时,你只能在下面的列表中找到名字。

可以使用jquery的自动完成插件http://jqueryui.com/autocomplete/

使用javascript数组作为数据源。您可以通过选择具有名称属性(如$("a[name]")

)的链接文本来动态构建数组。

当建议的选项被单击/选择时,您可以使用select事件将document.location.hash更改为该选项的值,这样浏览器将导航到该锚http://api.jqueryui.com/autocomplete/event-select