jquery autocomplete隐藏在关注结果上

时间:2014-01-31 07:01:10

标签: jquery autocomplete

我在jquery的自动完成方面遇到了麻烦。我以前曾多次使用过它,但这次显示出一个问题。当我尝试用鼠标悬停甚至按下按键时,自动完成结果隐藏起来。 这是我下面的代码。请帮帮我。

$(document).ready(function () {

if (document.getElementById("btnSearchPartyN")) {
    $('#btnSearchPartyN').click(function () {
        var htmWriter = [];

        htmWriter.push("<div class='divps' style='width:500px; background:#fff; margin:10px auto; border:solid 1px #ccc ;padding:0px 2px 2px 4px;'>");
        htmWriter.push("<span style='font:12px tahoma;'>Search Party : </span> ");
        htmWriter.push("<input name='keyword' style='padding:2px; width:320px; background:None; border:none;' type='text' class='pskeyword' />");
        htmWriter.push("<input class='txtps btnControlblue'  type='button' value='Search' />");
        htmWriter.push("</div>");
        htmWriter.push("<div class='psresults' style='width:500px; height:150px; margin:10px auto; border:solid 1px #ccc; padding:0px 4px; '>");
        htmWriter.push("<ul class='psul'>");
        htmWriter.push("<li>");
        htmWriter.push("<a href='#'>");
        htmWriter.push("<p class='psname'></p>");
        htmWriter.push("<p class='pscode'></p>");
        htmWriter.push("<p class='psadd'></p>");
        htmWriter.push("</a>");
        htmWriter.push("</li>");
        htmWriter.push("</ul>");
        htmWriter.push("</div>");

        $('body').append("<div class='ps' id='prn_ovelay'></div>");
        $('body').append("<div class='ps'  id='prn_wrapper'  style='font-family: Calibri;'> </div>");
        $('#prn_wrapper').append("<div class='ps' id='EditPODiv'  style='width: 600px; padding:0px 5px; background:#E9F9DF; border-radius:15px; margin: 100px auto;height: 470px;'></div>");
        $("#EditPODiv").append("<div class='controlformcap'></div>");
        $("#EditPODiv").append("<h1> <u>Search Party <u> </h1>");
        $("#EditPODiv").append(htmWriter.join('').toString());

        var availableTags = [
          "ActionScript",
          "AppleScript",
          "Asp",
          "BASIC",
          "C",
          "C++",
          "Clojure",
          "COBOL",
          "ColdFusion",
          "Erlang",
          "Fortran",
          "Groovy",
          "Haskell",
          "Java",
          "JavaScript",
          "Lisp",
          "Perl",
          "PHP",
          "Python",
          "Ruby",
          "Scala",
          "Scheme"
          ];
        $("[name=keyword]").autocomplete({
            source: availableTags

        });


    });
}

});

0 个答案:

没有答案