【问题标题】:Customizing JQuery autocomplete to add Static HTML content before and after the list自定义 JQuery 自动完成以在列表前后添加静态 HTML 内容
【发布时间】:2012-06-11 06:44:13
【问题描述】:

嘿,我需要在使用自动完成功能动态生成的列表之前和之后添加 HTML 内容........以下是我的代码 sn-p..我已尝试追加,添加到 li但没有运气......而且我还需要将列表中的项目数限制为最多 5 个。我该怎么做?

$(document).ready(function () {
               $("#autocomplete").autocomplete({

                   source: source,
                   select: function (event, ui) {

                       window.location.href = ui.item.value;
                       this.autohide();
                   }

               })
                 .data("autocomplete")._renderItem = function (ul, item) {
                     $("<li></li>")
                 .data("item.autocomplete", item)
                 .append("<a>" + "<img src='" + item.imgsrc + "' /><strong>" + item.label + "</strong></a>")
                 .appendTo(ul)                        
                 };


           });

【问题讨论】:

    标签: jquery autocomplete customization jquery-autocomplete


    【解决方案1】:

    看看这个jqfaq.com 链接。这将向您解释如何在自动完成结果列表的开始和结束处添加文本。

    查看列表中您可能感兴趣的其他与自动完成相关的常见问题解答。

    【讨论】:

      猜你喜欢
      • 2011-12-06
      • 1970-01-01
      • 1970-01-01
      • 2012-01-26
      • 2011-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多