jQuery Mobile Question:
Why is not DOM ready working for jQuery Mobile?
Answer:
One of the first things people learn in jQuery is to use the $(document).ready() function for executing DOM-specific code as soon as the DOM is ready (which often occurs long before the onload event). However, in jQuery Mobile site and apps, pages are requested and injected into the same DOM as the user navigates, so the DOM ready event is not as useful, as it only executes for the first page. To execute code whenever a new page is loaded and created in jQuery Mobile, you can bind to the pageinit event.
Previous Question | Next Question |
Why are not some scripts and styles loading? | Why is only the first page of multi page document loaded? |