Question

I am using the following code to changePage from First.html

$.mobile.changePage("Second.html", { transition: "slide" });

But this is neither calling document.ready on Second.js or pageshow or pagecreate events.

How do I call a method in Second.js after Second.html is loaded?

Was it helpful?

Solution

I would guess your problem is related to placement of your Second.js file.

When loading intermediate pages, jQuery Mobile will strip whole page and load only BODY content. This is because jQuery Mobile uses AJAX for page handling. Only first (initial) page is fully loaded into the DOM. For other pages it is not necessary to load everything, no point if you already have whole page loaded into the DOM.

Read this article to find more about this problem. You will find several working solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top