0

我有一个 JQuery 自动完成框,但是它不能正常工作。搜索工作正常,但是当我显示结果(在自动完成框内)时,我看不到文本,只有一个非常薄的水平蓝色滑块,没有文本。

我正在使用 JQuery Theme Redmond,并有以下 js 调用:-

<head id="Head1" runat="server">
<link href="Content/Redmond/jquery-ui-1.10.2.custom.css" rel="stylesheet">
<script src="Scripts/jquery-1.9.1.js"></script>
<script src="Scripts/jquery-ui-1.10.2.custom.js"></script>    

JQuery如下: -

        //reports Navbar AutoComplete
    $("#reports-textSearch").autocomplete({
        source: function (request, response) {
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "Dashboard.aspx/FetchReports",
                data: "{'reportName':'" + document.getElementById('reports-textSearch').value + "'}",
                dataType: "json",
                success: function (data) {
                    response(data.d);
                    var val = $("#reports-textSearch").val();
                    //__doPostBack('div#UPMainMenu', val);
                },
                error: function (result) {
                    alert("Error");
                }
            });
        },
        messages: {
            noResults: '', results: function () {
            }
        }

    });

HTML如下:-

  <div id="navbar-reportsSearch">
      <div class="navbar-reportsAutoSearchBar">
          <input id="reports-textSearch"   />
      </div>
  </div>

我还为自动完成添加了一些样式,但似乎没有任何效果:-

#reports-textSearch {
width: 235px;
z-index: 100; 
position: relative
}


#reports-textSearch > li {
border: #000000;

}

任何想法为什么会发生这种情况?

4

1 回答 1

0

尝试更换

<input id="reports-textSearch"   />

<input type="text" id="reports-textSearch"   />

您还需要提及输入的类型

于 2013-04-17T13:17:45.023 回答