自动填充 - 无法正常工作

时间:2011-12-05 18:56:44

标签: jquery

我在Firefox中打开它并开始在文本框中输入,我没有给出任何选项。我错过了什么?

<script type='text/javascript' language='javascript'     src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js'></script>
<SCRIPT>
    $(function() {
        var availableTags = [
            "ActionScript",
            "AppleScript",
            "Asp"
        ];
        $( "#tags" ).autocomplete({
            source: availableTags
        });
    }); 
</SCRIPT>

<html>
<body>
<DIV class=demo>
    <DIV class=ui-widget>
        <LABEL for=tags>Tags: </LABEL>
        <INPUT id=tags> </INPUT>
    </DIV>
</DIV><!-- End demo -->
</body>
</html>

1 个答案:

答案 0 :(得分:1)

尝试

<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type='text/javascript' language='javascript'     src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js'></script>
<SCRIPT>
    $(function() {
        var availableTags = [
            "ActionScript",
            "AppleScript",
            "Asp"
        ];
        $( "#tags" ).autocomplete({
            source: availableTags
        });
    }); 
</SCRIPT>
</head>
<body>
<DIV class=demo>
    <DIV class=ui-widget>
        <LABEL for=tags>Tags: </LABEL>
        <INPUT id=tags> </INPUT>
    </DIV>
</DIV><!-- End demo -->
</body>
</html>

你错过了jQuery。