Is there any way I can run javascripts on JQM ‘pages’ loads? I have a graph that is supposed to appear in a single page of my JQM page, but if I load it on document.ready it only shows if I refresh that particular JQM ‘page’. If I refresh on any other ‘page’ my graph won’t load. Is there like a onload("#myDiv") function of some sort that could fix this? The only other solution I have made is to make a button that the user can click to load the graph, but it seems unecessary, should be able to load it automatically.
$(document).ready(function()
{
$('#wordcloud').bind('pageinit', function() {
alert("works!");
});
})
Is the code above somewhat close? I do not get an alert though.
Also tried this code both in the div, in the head (inside and outside) document(ready)
$('#wordcloud').live('pagebeforeshow', function() {
alert(2);
});
As pointed out in the doc, if you want to do something on jQueryMobile page loads, you’d have to use
$(document).bind('pageinit').