カテゴリ オプションを使用してオートコンプリートを作成しようとしていますが、catcomplete を使用して試行するとエラーが発生します。
TypeError: $.widget は関数ではありません "localhost/php25/js/jquery.ui.widget.js" 67 行目
TypeError: base はコンストラクターではありません "localhost/php25/js/jquery.ui.widget.js" 67 行目
TypeError: $("#search").catcomplete は関数ではありません "localhost/php25/index.php" 50 行目
これが私のコードです:
<html>
<head>
<meta charset="utf-8">
<title>Hello</title>
<script type="text/javascript" src="js/jquery-1.8.2.js"></script>
<script type="text/javascript" src="js/jquery.ui.autocomplete.js"></script>
<script type="text/javascript" src="js/jquery.ui.core.js"></script>
<script type="text/javascript" src="js/jquery.ui.position.js"></script>
<script type="text/javascript" src="js/jquery.ui.widget.js"></script>
<style type="text/css">
.ui-autocomplete{
padding: .2em .4em;
margin: .8em 0 .2em;
line-height: 1.5;
}
</style>
<script type="text/javascript">
$.widget( "custom.catcomplete", $.ui.autocomplete, {
_renderMenu: function( ul, items) {
var self = this,
currentCategory = "";
$.each( items, function(index, item){
if( item.category != currentCategory){
ul.append( "<li class='ui-category'>" + item.category + "</li>");
currentCategory = item.category;
}
self._renderItem( ui, item);
});
}
});
</script>
<script type="text/javascript">
$( function(){
var data = [
{label:"London Biggin Hill Arpt,BQH,United Kingdom",category:"airport"},
{label:"Longvic Airport,DIJ,France",category:"airport"},
{label:"Long Island Arpt,HAP,Australia",category:"airport"},
{label:"Long Island Macarthur Arpt,ISP,United States",category:"airport"},
{label:"Long Banga Airfield Arpt,LBP,Malaysia",category:"airport"},
{label:"Longview,United States",category:"city"},
{label:"Long Island,Australia",category:"city"},
{label:"Long Banga,Malaysia",category:"city"},
{label:"Long Bawan,Indonesia",category:"city"},
{label:"Londrina,Brazil",category:"city"}
];
$('#search').catcomplete({
source: data
});
});
</script>
</head>
<body>
<label for="search">Search: </label>
<input id="search" type="text" />
</body>
</html>
http://jqueryui.com/autocomplete/#categoriesに示されているようなコードを書きました
誰でも私を助けてくれますか。