Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7602013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:18:17+00:00 2026-05-30T23:18:17+00:00

I am trying to navigate around pages in jQuery Mobile and I am having

  • 0

I am trying to navigate around pages in jQuery Mobile and I am having trouble with dynamically created page and ajax loaded ones.

I have a page (page_2) from which I dynamically create a page (page_3) by using page3.appendTo($.mobile.pageContainer); and then $.mobile.changePage(page3);. It works fine and I can go back to page_2 by doing $.mobile.changePage($("#page_2"));. So far so good.

The problem is when I land in page_2 from another page (eg page_1). It this case, for some reason, page_2 disappears from $.mobile.pageContainer when I create page_3 (whereas page_1 remains). It prevents me from going back from the newly created page to page_2 where it technically belongs.

Any idea why? Is there any way I can prevent page_2 from being removed?

You can try it out there: page_1 and page_2

In short:
page_1 -> page_2 works
page_1 -> page_2 -> page_3 works
page_1 -> page_2 -> page_3 -> page_2 fails
page_2 -> page_3 -> page_2 -> page_3 works (however many loops you like)

Thanks a lot for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:18:19+00:00Added an answer on May 30, 2026 at 11:18 pm

    You can set the data-dom-cache attribute to true on the <div data-role="page" id="page_2"> element (the second page) so it isn’t removed once it’s navigated away from:

    <div data-dom-cache="true" data-role="page" id="page_2">
        ...
    </div>
    

    Docs: http://jquerymobile.com/demos/1.1.0-rc.1/docs/api/data-attributes.html

    jQuery Mobile’s default behavior is to remove any pseudo-page from the DOM that was brought in by AJAX after the user navigates away from it. So when you link to remote documents, use absolute links that point to the URL of the document, not the ID of it’s <div data-role="page"> element.

    Your dynamically created page three uses this to navigate back to the second page:

    $.mobile.changePage($("#page_2"));
    

    It could change to:

    $.mobile.changePage('/page_2.html');
    

    If you link to pages like this, they will by default be removed from the DOM after they are navigated away from, the idea is that you are less likely to crash a mobile device’s browser if there are minimal pages in the DOM. There is also the chance that the page will just be pulled in from cache so no HTTP request is made in that case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table, trying to figure out how to navigate to the 3.35
am trying to goto a page from main window by using I have put
I am trying to navigate from one page to another on a button click
I think my question revolves around me not having a comfortable grasp of page
I am trying to navigate to an administration page which has a sub directory
I am having a lot of trouble trying to get my computer to run
I'm trying to navigate from the codebehind of a Silverlight page back to an
I have been trying to validate my web page for the last two hours,
I trying to navigate my new EC2 setup and was hoping to find an
Hey guys I'm trying to make a GUI which can navigate through JTextAreas when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.