Jquery 搜索框自动提示

为文本框增加自动提示下拉功能,比如输入 1,则从后台数据库查询出包含1 的字段,在文本框增加下拉列表供用户选择

ajax 返回数据为搜索查询字段的json集合

<script src="../../Scripts/JqueryUInew/jquery.autocomplete.js" type="text/javascript"></script>

    <link href="../../Scripts/JqueryUInew/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function() {

        $("#txtCourseNameSearch").autocomplete("../AutoCompleteTextView/AutocompleteCourse.ashx?id=3", {
                dataType: "json",
                selectFirst: false,
                highlight: false,
                multiple: true,
                multipleSeparator: " ",
                scroll: true,
                scrollHeight: 300

            });
        });
        </script>

猜你喜欢

转载自www.cnblogs.com/happygx/p/8908912.html