2017-01-17 11 views
0

jqueryを使用してDjangoでオートコンプリート検索入力を実装しようとしています。jqueryオートコンプリートが定義されていません

私はこの問題に関してかなりの類似の質問を見ましたが、私の特定のケースは何も解決しませんでした。私はheadに次きbase.htmlを拡張し、私のhome.htmlクラスで次に

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> 
 
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

次のようになり、私はheadを持っている私のbase.htmlクラスで

<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.18/themes/base/jquery-ui.css" type="text/css" media="all"/> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
私は home.htmlに行くとき enter image description here

は、その後、私は持っている私のhome.htmlファイルの<body>に:私のhome.htmlために

<input name="object-search"class="form-control "id="search"> 
 
<script type="text/javascript"> 
 
    $(function() { 
 
     $("#search").autocomplete({ 
 
      source: "/api/", 
 
      minLength: 1, 
 
     }); 
 
    }); 
 

 
</script>

次のようになります次のエラーを取得するまたは: enter image description here

+0

'jQuery'ライブラリも添付しましたか? – marian0

+0

私のjavascriptの無知を許しますが、この行が何であるかは分かりません: ' 「 – cph2117

+0

私の悪い、すみません、私は何とかそれを逃しました。しかし、あなたの 'home.html'とそれに添付されている' jquery.ui'に確実に添付されているかどうか確認できますか? – marian0

答えて

0

非常にダムエラーです。 base.htmlファイルの末尾に余分な<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> がありました。これは他のインポートを無効にする/無効にする必要があります。

関連する問題