Hi,
I am creating an app using PhoneGap and I'm having trouble getting the selected id of a listview item when it is long pressed.
I have tried using the JQUeryMobile TapHold event which works but only gets the ID of the listview, not the individual items.
$('#listview').bind('taphold', '> li', function (event) {
alert($(this).index());
});
I am dynamically creating the list using the code below:
HTML:
<ul data-role="listview" id="listview"> </ul>
JQuery:
for(var i = 0; i<len; i++) {
var output = '<li><h3> Module Code: ' + results.rows.item(i).module + '</h3>Room: ' +results.rows.item(i).room +'</li>';
$('#listview').append(output).listview('refresh');
}
Any help is appreciated, thanks!