jQuery autocomplete -默认

<!doctype html>
<html>
<head>
<meta name="content-type" content="text/html; charset=gbk">
<title>jQuery UI Autocomplete - 默认功能</title>
<link rel="stylesheet"
    href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/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">检索: </label> <input id="tags">
    </div>
</body>
</html>

效果图:

  技术分享

  技术分享

参考:

  http://jqueryui.com/autocomplete/

  http://www.cnblogs.com/lwme/archive/2012/02/12/jquery-ui-autocomplete.html

主要是为了与solr搜索的自动提示功能 结合.

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。