这是我的Json结构(在datas.json文件中):
[
{
"id" : "1",
"title" : "Study English",
"descript" : " dslfd slfkdlfjs dbawliflankfna lfkjal; kfna.f, a.fka ljfbad.gks;gkn s.g <br/> fldjfdsljfsdlfd",
"creadata" : "2019/06/24-20:26:33"
},
{
"id" : "2",
"title" : "Meet Fred",
"descript" : " dslfd slfkdlfjs dbawliflankfna lfkjal; kfna.f, a.fka ljfbad.gks;gkn s.g <br/> fldjfdsljfsdlfd",
"creadata" : "2018/06/25-10:16:13"
},
这是我的jquery,用于从json捕获数据并将其显示为垂直列表
$.getJSON('datas.json', function(json) {
$.each(json, function() {
// 'this' is the current object of the iteration loop
$('div.indexTodo').append('<span id="lst_todo" alt="'+this.id+'"><p>' + this.title + '</p><i>'+ this.creadata +'</i></span>');
});
});
它是用于phonegap的,现在当用户单击$('#lst_todo')。attr('alt')时,我将在同一块(json文件中)中向用户显示“ descript”。 怎么样? 谢谢