我想在輸入文本框上實現自動完成功能。我已經複製了所有的代碼,它似乎不工作。這是從jquery網站相同的代碼(自動完成的例子)任何幫助?簡單的jquery自動完成輸入框不工作
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<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>
</head>
<body>
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags">
</div>
</body>
</html>
//控制檯錯誤
Failed to load resource: net::ERR_FILE_NOT_FOUND file://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css
Failed to load resource: net::ERR_FILE_NOT_FOUND file:///C:/resources/demos/style.css
Failed to load resource: net::ERR_FILE_NOT_FOUND file://code.jquery.com/ui/1.10.4/jquery-ui.js
Failed to load resource: net::ERR_FILE_NOT_FOUND file://code.jquery.com/jquery-1.10.2.js
Uncaught ReferenceError: $ is not defined /C:/Users/Saad/Desktop/tHome.html:11
任何幫助嗎?
您的代碼工作在這裏罰款http://jsfiddle.net/j08691/xU3UP/。你檢查控制檯是否有錯誤? – j08691
jquery librarary的檢查路徑 –
這裏也可以工作 - > http://jsfiddle.net/eHr74/ – davidkonrad