为什么搜索插件要双击才能显示出来?

<div id="divtest">
            <div class="title">
                <span class="fl">搜索插件</span>
            </div>
            <div class="content">
                <span class="fl">用户名</span><br />
                <input id="txtSearch" name="txtSearch" type="text" />
                <div class="tip">
                </div>
            </div>
        </div>
        
        <script type="text/javascript">
            $(function () {
                var arrUserName = ["王五", "刘明", "李小四", "刘促明", "李渊", "张小三", "王小明"];
                $("#txtSearch").autocomplete(arrUserName,{
                    minChars: 0, //双击空白文本框时显示全部提示数据
                    formatItem: function (data, i, total) {
                        return "<I>" + data[0] + "</I>"; //改变匹配数据显示的格式
                    },
                    formatMatch: function (data, i, total) {
                        return data[0];
                    },
                    formatResult: function (data) {
                        return data[0];
                    }
                }).result(SearchCallback);
                function SearchCallback(event, data, formatted) {
                    $(".tip").show().html("您的选择是:" + (!data ? "空" : formatted));
                }
            });
        </script>
    </body> 输入的时候下面不会有提示 双击选中才会有提示,为什么?

cindy姣姣
浏览 1398回答 2
2回答

阿西Bug_duang

minChars:最小触发的字符个数。0表示双击即刻触发

linsword20

这要看你这个autocomplete插件吧
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JQuery