javascript - Getting row data in dynamically created listview -
hi i'm creating list view dynamically. want data of particular row on click, proceed further steps. code below
function getlist(tx, results){ $('#deliverylist').empty(); var len = results.rows.length; for(var i=0; <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'); }
my html file looks like
<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>
can 1 me achieve result. in advance.
it worked me below code
$('ul').children('li').on('click', function () { alert('selected name=' + $(this).text()); });
Comments
Post a Comment