嘗試使用下面的例子不要忘記,包括Jquery最新的文件;)恩喬伊弟兄
<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$("#tags").autocomplete({
source: availableTags
});
});
</script>
<div class="demo">
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags">
</div>
</div><!-- End demo -->
<div style="display: none;" class="demo-description">
<p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are tags for programming languages, give "ja" (for Java or JavaScript) a try.</p>
<p>The datasource is a simple JavaScript array, provided to the widget using the source-option.</p>
</div><!-- End demo-description -->
來源
2012-07-20 12:54:52
GOK
我無法跟隨在這個例子中,我的「#tags」是什麼以及什麼是源 – user1491704 2012-07-19 19:06:23
在頁面右側單擊「遠程JSONP數據源」,然後在「查看源代碼」中單擊中間,然後您將看到整個示例。 – PoulsQ 2012-07-19 19:08:26
找不到這樣的東西:( – user1491704 2012-07-19 19:14:18