有时候可能需要为一个标签添加一些额外的属性,比如为图片添加描述,可以采用如下做法:
current = $(selector);
ac_obj=new Object();
ac_obj.title = ac_list[i].title;
ac_obj.introduction = ac_list[i].introduction;
ac_obj.time = ac_list[i].time;
current.data(ac_obj);
读取数据操作:
var title = $(this).data("title");
var introduction = $(this).data("introduction");
var time = $(this).data("time");