jQuery自动完成显示在错误的位置

时间:2014-03-21 10:35:48

标签: javascript jquery autocomplete jquery-autocomplete

以下是我的代码

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问题。

1 个答案:

答案 0 :(得分:1)

我认为你刚刚没有实现UI css:

http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/redmond/jquery-ui.css