jQuery Mobile Question:
Download Questions PDF

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.

Download jQuery Mobile Interview Questions And Answers PDF

Previous QuestionNext Question
Why are not some scripts and styles loading?Why is only the first page of multi page document loaded?