我環顧了類似上面的問題,並沒有一個幫助。
這裏是我的腳本
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script type="text/javascript" src="network.json"></script>
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
<link type="text/css" href="http://code.jquery.com/ui/1.9.1/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<body>
<link href="ajs_network1.css" rel="stylesheet" type="text/css" />
<script src="ajs_network1.js" type="text/javascript"></script>
</body>
下面是函數試圖調用JQuery的
$(function() {
$("#search").autocomplete({
source: optArray
});
});
出於某種原因,它造就了錯誤
TypeError: $(...).autocomplete is not a function.
我猜測香港專業教育學院完成腳本有問題嗎?
您需要添加的jQuery UI庫'<鏈接相對= 「樣式的」 href =「// ajax.googleapis.com/ajax/libs/ jqueryui/1.11.2/themes/smoothness/jquery-ui.css「/> \t ' – Satpal 2014-11-24 12:43:35
在頭標頂部加載jquery – 2014-11-24 12:44:15
與Satpal同意autocomplete是jQueryUI的插件,因此在jQuery lib之後包含此庫。 – Jai 2014-11-24 12:45:39