<html>
<head>
<title></title>
<script src="script/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="script/jquery.autocomplete.js" type="text/javascript"></script>
<script src="script/jquery-ui-1.8.13.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(window).ready(function () {
$(function () {
debugger;
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>
<input id="tags" type="text" />
</div>
</body>
</html>
这是它的fiddle链接,在Fiddle上运行正常,但不在VS
答案 0 :(得分:0)
将doctype添加到HTML文件中。如果没有给出正确的Doctype,某些浏览器不会运行javascript。
答案 1 :(得分:0)
我怀疑你在VS中使用的代码与小提琴版本不同。
小提琴代码看起来非常好,但您在此处发布的代码存在语法错误。您必须使用方括号来创建数组,而不是括号:
var availableTags = ["ActionScript", "AppleScript", "Asp", ... ];