store ID from listview in localStorage
问题 I've a listview created by a loop: for(var i = 0; i < data.length; i++) { var garage = data[i]; $("#content-p").append( "<ul data-role=\"listview\">" + "<li><a href=\"#\" id=\"submitID\" >" + "<h2>"+garage.location+"</h2>" + "<p><b>"+garage.description+"</b></p>" + "<p>"+garage.address+"</p>" + "</a></li>" + "</ul><br>" ); $("#submitID").click(function() { localStorage.setItem("garageID",garage.ID); $.mobile.changePage("#resP"); }); } Now the user can click on a listview item and the ID from