Carl Weis提出了一个问题:Cannot set property '_renderItem' of undefined jQuery UI autocomplete with HTML,或许与您遇到的问题类似。

Since I just joined and can't comment on drcforbin's post above, I guess I have to add my own answer.

drcforbin is correct, although it is really a different problem than the one that the OP had. Anyone coming to this thread now is probably facing this issue due to the new version of jQuery UI just released. Certain naming conventions relating to autocomplete were deprecated in jQuery UI in v1.9 and have been completely removed in v1.10 (see http://jqueryui.com/upgrade-guide/1.10/#autocomplete).

What is confusing, however, is that they only mention the transition from the item.autocomplete data tag to ui-autocomplete-item, but the autocomplete data tag has also been renamed to ui-autocomplete. And it's even more confusing because the demos are still using the old syntax (and thus are broken).

The following is what needs to change in the _renderItem function for jQuery UI 1.10.0 in the Custom Data demo here: http://jqueryui.com/autocomplete/#custom-data

Original code:

.data( "autocomplete" )._renderItem = function( ul, item ) {

return $( "

" )

.data( "item.autocomplete", item )

.append( "" + item.label + "
" + item.desc + "" )

.appendTo( ul );

};

Fixed code:

.data( "ui-autocomplete" )._renderItem = function( ul, item ) {

return $( "

" )

.data( "ui-autocomplete-item", item )

.append( "" + item.label + "
" + item.desc + "" )

.appendTo( ul );

};

Note the changes for both autocomplete and item.autocomplete. I've verified that this works in my own projects.

希望本文对你有帮助,欢迎支持JavaScript中文网

html jquery 不能自动完成,不能设置属性apos;_renderitem apos;定义jQuery UI自动完成HTML...相关推荐

  1. 360浏览器自动刷新选项设置方法

    360浏览器自动刷新选项设置方法 360浏览器不安装插件自动刷新怎么设置?我们使用浏览器在游览器贴吧的时候,经常会不同的按"Ctrl+R"或者是"F5"来刷新页 ...

  2. JQUERY操作html--获取和设置内容、属性、回调函数

    一:jQuery - 获取内容和属性 1.获得内容 - text().html() 以及 val() text() - 返回所选元素的文本内容 html() - 返回所选元素的内容(包括 HTML 标 ...

  3. css 背景图怎么设置自动填充满_CSS属性设置 -- 背景样式

    Ⅰ background-color: -- 设置标签的背景颜色 rgba(0,0,0,0.65); -- (红,緑,蓝三原色,透明度)只能给背景设置透明度 opacity: 0.65; -- 改变整 ...

  4. jQuery中的attr()与prop()设置属性、获取属性的区别

    举例,比如我们要获取checkbox的属性或者设置checkbox选中或不选中. $("#editForm").find("input[type='checkbox']& ...

  5. jquery获取和设置属性_jQuery获取属性,设置属性,删除属性

    jquery获取和设置属性 Today we will look into following examples – jQuery get attribute, jQuery set attribut ...

  6. jQuery attr()获取属性和设置属性的方法

    前言: 在JS中设置节点的属性与属性值用到setAttribute(),获得节点的属性与属性值用到getAttribute(),而在jquery中,只需要用到attr()这个函数就可以了.attr是a ...

  7. Jquery获取与设置属性

    1.   jQuery 拥有可操作 HTML 元素和属性的强大方法 获得内容 - text().html() 以及 val() 三个简单实用的用于 DOM 操作的 jQuery 方法: text() ...

  8. jQuery四:获取、设置、移除属性;attr(“href“)、attr(“href“,“http://www.baidu.com“)、removeAttr(“href“);

    attr()方法是用于设置标签的属性,比如src,href,title:(这些更多的是元素的基本属性,HTML的属性): 目录 一:操作元素属性 (1)attr()方法:只传一个参数:获取属性 (2) ...

  9. jquery设置属性值或移除属性

    为什么80%的码农都做不了架构师?>>>    设置属性值: $("#inputID").attr("属性名","属性") ...

最新文章

  1. QIIME 2教程. 13训练特征分类器Training feature classifiers(2020.11)
  2. dz 数据表分析!!!
  3. 网闸与防火墙的区别_网关和网闸、防火墙的区别?
  4. php ci hooks,CI框架 -- 核心文件 之 Hooks.php
  5. python发送短信接口_python发送短信和发送邮件
  6. 组态王c语言编程实例,组态王命令语言程序.doc
  7. 浅谈事理图谱认知:系统体系+领域收敛+人机协同+辅助范式
  8. OpenCV学习笔记(三):多通道图像分离、混合算子:split(),merge()
  9. java lambda map用法_Java 中如何使用 lambda 表达式填充 Map?
  10. Python编程:从入门到实践 - pygal篇 - Die
  11. 三菱mode bus tcp通讯_邢台三菱MR-J4-200B4
  12. TASKCTL-作业属性总体概述
  13. 基于struts2的个人信息管理系统(一)
  14. webworker应用场景_多线程编程开发应用场景
  15. bmp格式如何转换成png格式
  16. 干货知识:高清监控怎么选配交换机
  17. 程序员找工作的个人经验教训以及注意事项
  18. 2019年南京大学计算机考研分数线,南京大学2019年考研复试分数线已公布
  19. Homebrew 无法下载安装文件的解决方法
  20. 【数据结构】图的基本操作

热门文章

  1. 设计灵感|各种孟菲斯风格海报,让你眼花缭乱
  2. 超前促销创意PSD分层电商海报,紧抓住消费冲突视觉力!
  3. 有哪些网站社区可以看原创平面设计大师作品?
  4. 设计素材模板|如何从优秀作品里学习版面设计?
  5. 应用程序已被java 1.6_Apple Java更新1.6.0_51之后,Swing应用程序卡住了
  6. LeetCode-----替换空格
  7. Segment Descriptors, Code- and Data-Segment Descriptor Types
  8. linux中打开gif图片命令,在Linux终端中安装使用Gifski创建GIF动图
  9. 结巴分词关键词相似度_jieba+gensim 实现相似度
  10. mbsfn子帧_LTE多媒体广播多播业务关键技术研究