This is because jQuery Mobile only loads the code inside the first data-role="page" element in the DOM.
There are several options on which you can choose how to fix it:
- You can put your JS code for the page in the
data-role="page" element, so it will be loaded when jQuery Mobile loads the page via AJAX. - You can put all your code in one JS file and include it on every page on the site, it will be downloaded only for full-page updates, but this way all the code for your site will be available all the time (after minimizing and compressing you really need to have a lot of code to make it ineffective).
I'm sure there are other methods, but here is a couple in which I worked for me.
source share