I'm using the data-* attribute to pass parameters between pages and it works, but only the first time.
I have a dynamically generated list of which I bind each <li> to a click event which adds the data attribute data-objectid to the target page. When I click a <li> the first time, lets say K0001, it works, but if I back and click another <li> the code $(this).data("objectid") returns the previous result (K0001). However, if I check the element in Chrome the data-objectid has the correct value (K0002). I'm having a hard time understanding why.
Here's some code:
//This code produces the list
function listObjects(t, result) {
$("#objectListItems").empty();
for (i = 0; i < (result.rows.length); i++) {
var list = $("<li>");
var details = $("<a>").text(result.rows.item(i).kpt);
And finally, the code that is supposed to update the class cableBoxName with the data-objectid attribute, which only works the first time, even though the objectid tag is correct the second time:
$("#cableBoxMenu").live("pageshow", function (event, ui) {
var id = $(this).data("objectid");
alert(id);
$(".ui-page-active .cableBoxName").text(id);
});
I have also added an image so that you can see what I mean:
I'm having trouble getting my webapp to work on my iPhone when going offline. It works online, but when switching to flight mode the links doesn't work. I suspect it's the same problem as this issue(https://github.com/jquery/jquery-mobile/issues/926), but I'm using the latest jQuery and JQM files and still I get the problem.
So my question is if the issue is fixed and if not, how can I fix it myself.
PS. I've got one index file in the root with the menu, and three other views under a separate "Views" folder. I've read somewhere that it works if you make a single HTML file.