HTML。
<div id="listsalon">
<ul data-role="listview" data-inset="true" data-filter="true" >
</ul>
</div>
JS。
for (var i = 0; i < arr.length; i++) {
companyname = arr[i].CompanyName;
picture = arr[i].Picture;
address = arr[i].Address;
$("#listsalon ul").append("<li class='ui-corner-all'>" +
"<a id=" + '"' + "salon" + (i + 1) + '"' + "><img src='" + picture +
"'style='height:160px; width:200px;' class='ui-corner-all'>" +
"<h2 style='font-size:13px'>" + companyname + "</h2>" +
"<p style='font-size:10px'>" + address + "</p>" +
"</a></li>");
}
$("#salon1").bind("click", function () {
window.location = "salon.html"
});
问题:所以首先我拉数据并放入3个变量,公司名称,图片和地址。我有 x 组这些数据。我想放入一个列表形式。我可以列出来,但该功能无法识别该 ID 并且它不起作用。请帮忙。
相关分类