码迷,mamicode.com
首页 > Web开发 > 详细

jQuery autocomplete -默认

时间:2015-04-24 16:16:36      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

<!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搜索的自动提示功能 结合.

 

jQuery autocomplete -默认

标签:

原文地址:http://www.cnblogs.com/a198720/p/4453602.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!