I have an HTML5 (+JQM) page:
...
<div data-role="header">
<a data-rel="home" ... href="index.html"></a>
</div>
...
after home button is pressed, and home page (“index.html”) loads,
$(document).ready(function() {
does not fire; nor does fire
$("div[data-role*='page']").live('pageshow', function() {
I need to run some code every time my home page is loaded, doesn’t matter if it’s loaded directly or after a “home” button…
As per the docs use the PageInit event please. This is the recommended event to use if you need to code to run every time your page loads.
However, after my being dumb moment, I realise what you’re doing. But I can’t find a “data-rel” attribute of “home” on the docs page? http://jquerymobile.com/demos/1.2.0/docs/api/data-attributes.html
I assume you have a multi-page template – using index.html and another.html file. I suspect you’ll need to add
rather than “home” when navigating between the html files?