jquery autocomplete()不起作用

时间:2010-06-06 15:03:36

标签: jquery

<link rel="stylesheet" type="text/css" href="jquery-ui-1.8.2.custom.css" />
<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>


<body>
Search: <input id="example" /> 
</body>

<script>
$(document).ready(function(){
var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
$("#example").autocomplete(data);
});
</script>

1 个答案:

答案 0 :(得分:2)

由于您的示例直接来自Autocomplete plugin page,我猜这是您尝试使用的插件。您需要将其下载并放在代码可以使用的位置。

<script src="http://code.jquery.com/jquery-latest.js"></script>
<!-- You'll want to change this next line to your local copy of the plugin. -->
<script src="jquery.autocomplete.js"></script> 

Search: <input id="example" /> 

<script>
$(document).ready(function(){
var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
$("#example").autocomplete(data);
});
</script>