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 9020689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:05:00+00:00 2026-06-16T05:05:00+00:00

I have a single html page that I’m using jquery mobile on to create

  • 0

I have a single html page that I’m using jquery mobile on to create a web app with multiple divs with the data-role=”page” attribute. Each page has a fixed header and footer that remains consistent through page transitions.

However, I want to load another html page not built in the jquery-mobile framework but in the same directory into the DOM and have the persistent, fixed header and footer appear over that page.

Is this possible? I’ve looked at the jquery Mobile documentation for using $mobile.changePage() and $mobile.loadPage() and am not really clear on how to implement it.

Thus far I have this (edited per @Jack’s instructions):

HTML

    <div data-role="page" id="dog_bars">
    <div data-role="header" data-position="fixed" data-id="dog_header" class="custom_dog_header">
        <h1>Dog About Town</h1>
    </div>
    <div data-role="content">
        <ul data-role="listview" data-filter="true">
            <li data-icon="home"><a href="#external_page" data-transition="slide" id="external_link">
                <h2>303 Bar &amp; Grill</h2>
                <p>303 W. Davis St., Dallas</p>
        </a></li>
            </ul>
    </div>
    <div data-role="footer" data-id="bestFooter" data-position="fixed">
        <nav data-role="navbar">
            <ul>                
                <li><a href="#home" data-transition="slide" data-role="button" data-icon="home">Home</a></li>
                <li><a href="#about" data-transition="slide" data-role="button" data-icon="gear">About</a></li>                    
            </ul>            
        </nav> 
    </div><!-- end footer -->          
</div>


<!-- page to be loaded into -->

<div data-role="page" class="content_page" id="external_page">
    <div data-role="header" data-position="fixed" data-id="dog_header" class="custom_dog_header">
        <h1>Casual Dining</h1>
    </div><!-- end header -->
    <section data-role="content" class="content" id="external">

    </section>
    <div data-role="footer" data-id="bestFooter" data-position="fixed">
        <nav data-role="navbar">
            <ul>                
                <li><a href="#home" data-transition="slide" data-role="button" data-icon="home">Home</a></li>
                <li><a href="#dog_casual" data-transition="slide" data-role="button" data-icon="back">Back</a></li>                    
                <li><a href="#about" data-transition="slide" data-role="button" data-icon="gear">About</a></li>                    
            </ul>            
        </nav> 
    </div><!-- end footer -->
</div><!--end page-->   

Jquery

$(document).on('pageinit'(function() {
$("#external").load("external_page.html").trigger("create");
}));

Currently, clicking on the link loads the #external_page just fine with the header and footer, but the content of external_page.html does not load. The section of #external_page is still empty.

Thoughts?

  • 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-06-16T05:05:02+00:00Added an answer on June 16, 2026 at 5:05 am

    You should be able to this using jQuery’s load to load the external page and then wrap that in a div with a data-role="page" with the appropriate headers/footers, append it to the DOM and then trigger the create event to initialize the page. Alternatively you can also prepare a page wrapper (div with data-role="page") on your first page and just insert the contents of your external page into there (the way you are attempting to do so now).

    Looking at your current JavaScript, your syntax for .on is a little off, and your missing a comma.

    Using your markup you should be able to do the following

    <div data-role="page" id="dog_bars">
        <div data-role="header" data-position="fixed" data-id="dog_header" class="custom_dog_header">
            <h1>Dog About Town</h1>
        </div>
        <div data-role="content">
            <ul data-role="listview" data-filter="true">
                <li data-icon="home"><a href="#external_page" data-transition="slide" id="external_link">
                    <h2>303 Bar &amp; Grill</h2>
                    <p>303 W. Davis St., Dallas</p>
            </a></li>
                </ul>
        </div>
        <div data-role="footer" data-id="bestFooter" data-position="fixed">
            <nav data-role="navbar">
                <ul>                
                    <li><a href="#home" data-transition="slide" data-role="button" data-icon="home">Home</a></li>
                    <li><a href="#about" data-transition="slide" data-role="button" data-icon="gear">About</a></li>                    
                </ul>            
            </nav> 
        </div><!-- end footer -->          
    </div>
    
    
    <!-- page to be loaded into -->
    
    <div data-role="page" class="content_page" id="external_page">
        <div data-role="header" data-position="fixed" data-id="dog_header" class="custom_dog_header">
           <a href="#" data-rel="back" data-icon="back">Back</a> <h1>Casual Dining</h1>
        </div><!-- end header -->
        <section data-role="content" class="content" id="external">
    
        </section>
        <div data-role="footer" data-id="bestFooter" data-position="fixed">
            <nav data-role="navbar">
                <ul>                
                    <li><a href="#home" data-transition="slide" data-role="button" data-icon="home">Home</a></li>
                    <li><a href="#dog_casual" data-transition="slide" data-role="button" data-icon="back">Back</a></li>                    
                    <li><a href="#about" data-transition="slide" data-role="button" data-icon="gear">About</a></li>                    
                </ul>            
            </nav> 
        </div><!-- end footer -->
    </div><!--end page-->   
    
    
        <script type="text/javascript">
            $(document).on('pageinit', '#dog_bars', function () {
                 //you can probably leave out the trigger('create') since the wrapper
                 //is already part of the DOM and JQM should enhance it
                $('#external').load("external_page.html").trigger("create");
            });
        </script>
    

    external_page.html

    <!DOCTYPE >
    <html >
    <head>
        <title></title>
    </head>
    <body>
        <div id="pageWrapper">
            <p>Some test text</p>
            <input type="text" />
    
            <select>
                <option value="value">Option1</option>
                <option value="value2">Option2</option>
            </select>
    
        </div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mobile single-page web application that is built using jquery-mobile (jqm) and
I have a single page web app that shows real time data using just
I have created a tiny Jquery Mobile app in a single HTML page. The
My jQuery Mobile app consists of a single index.html page and contains only one
Here's what I have: A web application that runs in a single HTML page
I have a single xml document (data.xml), which I display as HTML using an
I have a single .jar file that I create by using the runnable .jar
I have three single html pages in jquery mobile application with phonegap. From a
I have a small jQuery mobile site. it's all single .html file it's has
At the moment I have a single html page that has 4 templates in

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.