有人可以发布一个简单的html代码如何实现它,与简单的数据对象。
这里是链接http://code.drewwilson.com/entry/autosuggest-jquery-plugin
我已经想尽办法让它工作了,但到目前为止还没有成功,有人能帮帮忙吗?
谢谢
梅森
发布于 2010-09-09 04:21:02
这似乎工作得很好(基本上是从网站上得到的),可能需要一些样式来得到你想要的。我也不确定你的数据将从哪里来,但他也有一些ajax的例子。
无论如何,将以下代码另存为.html文档作为示例。
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="http://the-know-your-rights.googlecode.com/svn-history/r10/trunk/resources/js/jquery/autoSuggest/jquery.autoSuggest.minified.js"></script>
<script type="text/javascript">
var $sel = null;
$(document).ready(function () {
var data = {items: [
{value: "21", name: "Mick Jagger"},
{value: "43", name: "Johnny Storm"},
{value: "46", name: "Richard Hatch"},
{value: "54", name: "Kelly Slater"},
{value: "55", name: "Rudy Hamilton"},
{value: "79", name: "Michael Jordan"}
]};
$("input[type=text]").autoSuggest(data.items, {selectedItemProp: "name", searchObjProps: "name"});
});
</script>
</head>
<body>
<input type="text" />
</body>
</html>如果这不是你想要的,那就用更多的细节来更新你的问题,我会看看能不能给你一个更好的答案。
https://stackoverflow.com/questions/3670665
复制相似问题