jQuery的data()方法绑定了一个对像,但是在获取该对象时是undefined,请教

绑定对象
$(list).each(function(){
// alert(list[i]);
var li = '

'+this.cn_notebook_name+'';
$('#first_side_right ul').append(li);
$('#first_side_right ul li:last').data("noteBook",this);
});

获取绑定对象

var checked_li = $('#first_side_right .checked').parent();
    console.log(checked_li);
    var notebook = checked_li.data("noteBook");
    console.log(notebook+"sdf");

浏览器错误信息
[prevObject: o.fn.init[0], context: document, jquery: "2.1.0", constructor: function, selector: ""…]context: documentlength: 0prevObject: o.fn.init[0]__proto__: o[0]
local.js:166 undefinedsdf
note.js:50 Uncaught TypeError: Cannot read property 'cn_notebook_id' of undefined

你的this是谁你知道吗?你到底要放什么东西?你要知道this不是list[i],function有两个参数的,一个代表的是list[i],还有一个就是i,你找下jquery的帮助文档

手头没帮助文档,n,i得顺序不知道写反了没有,你试下就知道了

 $(list).each(function(n,i){
var li = '
'+n.cn_notebook_name+'';
$('#first_side_right ul').append(li);
$('#first_side_right ul li:last').data("noteBook",n);
});