首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >无法读取具有JS的单页应用程序中未定义的属性'name‘

无法读取具有JS的单页应用程序中未定义的属性'name‘
EN

Stack Overflow用户
提问于 2018-05-31 17:28:55
回答 1查看 120关注 0票数 0
代码语言:javascript
复制
function Drawitems() {
  var $list = $("#shoppinglistitems").empty();
  //go through the list array to get elements ---->we will do that by using for loop 
  for (var i = 0; i < currentlist.items.length; i++) {
    var currentitem = currentlist.items[i];
    //create dom element for this list item
    var $li = $("<li>").html.currentitem.name.attr("id", "item_" + i)
    var $DeleteBt = $("<button>D</button>").appendTO($li);
    var $CheckBt = $("<button>C</button>").appendTO($li);
    $li.appendTO($list);
  }

当我尝试在google chrome上显示应用程序时,出现以下错误:

未捕获名称:无法读取未定义的属性‘TypeError’,因此我该怎么办

诚挚的问候

EN

回答 1

Stack Overflow用户

发布于 2018-05-31 18:28:43

试一试

代码语言:javascript
复制
var $li = $("<li>").html(currentitem.name).attr("id", "item_" + i)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50621002

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档