I understand that I can handle the pageinit() or other events to execute JavaScript for a newly loaded page, but that requires me to have the actual JavaScript exist or be reference from the Main page.
How can I include scripts at the bottom of a sub page, and have it execute on load of the page?
I tried to set the sub page’s function to a global variable (I know it’s dirty), but even that doesn’t seem to work.
Found the answer myself. It looks like the JavaScript on the child page needs to be inside the “page”, not just inside the body tag:
Pro tip:
It looks like any script inside the body but outside the “Page” element, even on the main page (first loaded page), don’t get executed!!! So even if you disabled the AJAX loading/transitions of jQuery mobile, the default page rendering still kills those scripts.