以下是我的代码
HTML:
<input autofocus="autofocus" type=text id="modelloInput" style="width: 97%; outline:none; border:none; margin-left: 7px; float: left;" />
JS:
<script type="text/javascript">
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$(document).ready(function () {
$('#modelloInput').autocomplete({
source: availableTags
});
});
</script>
它正在工作,但我看到“自动完成列表”远离输入,并且在名称之前有一个点,如html列表。
可能是什么问题?我猜这是CSS问题。
答案 0 :(得分:1)
我认为你刚刚没有实现UI css:
http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/redmond/jquery-ui.css