嗨,我正在动态创建列表视图。我想在点击时获取特定行的数据,以继续执行进一步的步骤。我的代码如下
function getList(tx, results){
$('#DeliveryList').empty();
var len = results.rows.length;
for(var i=0; i <len; i++)
{
var deliveryItems = results.rows.item(i);
var html = '<li data-role="list-divider">'+deliveryItems.DeliveryName+ ' | ' + deliveryItems.PrimaryName+' <span class="ui-li-count">Copay ='+deliveryItems.Total+'</span> </li><li><a><img src="Pending"/><h3>'+deliveryItems.Name1+'</h3><p>'+deliveryItems.Address+'</p><p>'+deliveryItems.City+' <b></b></p><p><strong>'+deliveryItems.ContactNumber+'</strong></p><a href="#PrescriptionPage" class="cls_btn" id="btn_list" onclick = "Prescription()" >Delivary Details</a></a></li>';
$('#DeliveryList').append(html).trigger('create');
}
$('ul').listview('refresh');
}
我的 html 文件看起来像
<div data-role="page" id="page3" >
<div data-role="header">
<a href="#page1" data-icon="back">Back</a>
<h1>Heading</h1>
<a href="#Page2" class="ui-btn-right" type="submit" data-role="button" data-icon="home" data-theme="b" data-mini="true">Home</a>
</div><!-- /header -->
<ul data-role="listview" id="DeliveryList" data-inset="true" data-theme="d" data-divider-theme="b"> </ul>
</div>
任何人都可以帮助我实现结果。提前致谢。