1

我正在使用 jQuery 自动完成的 _renderItem 功能来覆盖结果的默认显示。

有没有办法不需要将自定义 html 包装在锚标记中?我问的原因是我的实际自定义 html 在其中包含锚点,并且将整个自定义 html 包装在锚点本身中使它看起来很糟糕。

这一定是可能的?!

当我不将其包装在锚标记中时,FireBug 将返回错误:

TypeError: d.item is undefined

https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js 第5行

这是我的自动完成功能...您会看到“附加”功能上没有标签

jQuery("#omni-search-input").autocomplete({

                                source: "/json-search/",
                                minLength: 3
                            })
                            .data("autocomplete")._renderItem = function(ul,item)
                            {

                                return jQuery("<li></li>").data("item.autocomplete",item).append("<div class=''>custom html with anchors in and tables and things<div>").appendTo(ul);
                            }
4

0 回答 0