Autocomplete插件的小例子

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />

<script src=\'#\'" //code.jquery.com/jquery-1.8.3.js"></script>

<script src=\'#\'" //code.jquery.com/ui/1.9.2/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>

 

你可能感兴趣的:(jquery)