Ola*_*laf 4 jquery autocomplete
我们花了很多时间试图让一个非常简单的脚本工作(其他人似乎都很成功).最后,我们想要使用JQuery创建一个autosuggest文本框,将所选文本的值写入隐藏字段,但这个问题与此无关,因为即使是第一步也失败了(但是非常欢迎使用示例代码).
出于某些不明原因,不执行formatItem(和其他格式化函数).我们有什么误解?
任何帮助都非常感谢.
这是代码(剥离了示例中不需要的任何内容):
<html>
<head>
<title>Why o why?</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function() {
var s = ["a", "b", "ab"];
$("#txtSearch").autocomplete({
source: s,
formatItem: function(row, i, n) { return "whatever" },
minLength: 1
});
});
</script>
</head>
<body>
Search <input id="txtSearch" type="text" />
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这样的autosuggest函数可以在任何浏览器中使用,但是没有浏览器触发formatItem.
归档时间: |
|
查看次数: |
7555 次 |
最近记录: |