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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:27:42+00:00 2026-06-01T05:27:42+00:00

I have the following jQueryMobile page anatomy at index.html: <div data-role=page> <div data-role=header>…</div> <div

  • 0

I have the following jQueryMobile page anatomy at index.html:

<div data-role="page"> 
    <div data-role="header">...</div> 
    <div data-role="content">...</div> 
    <div data-role="footer">...</div> 
</div> 

I’m interested in loading the other pages (that don’t have this anatomy) to data-role="content" through AJAX in order to use the same header and footer accross all the pages.

The code bellow works fine but doesn’t refresh the elements with jQueryMobile styles.

$( 'div:jqmData(role="content")' ).load( 'pages/home.html' );
  • 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-01T05:27:43+00:00Added an answer on June 1, 2026 at 5:27 am

    All you need to do is tell the jQuery Framework to initialize the new widgets:

    $( '.ui-content' ).load( 'pages/home.html', function () { $(this).trigger('create') });
    

    Also, if all you want is a persistent header/footer then you should check-out just that feature that jQuery Mobile has: http://jquerymobile.com/demos/1.1.0-rc.1/docs/toolbars/footer-persist-b.html

    Here is a demo: http://jsfiddle.net/VMhz4/1/

    Update

    You can dynamically add data-role="button" to links like this if you need:

    $( '.ui-content' ).load( 'pages/home.html', function () {
    
        //after the AJAX request has resolved and the HTML has been added to the DOM, this will run
    
        //find all the links that were just added to the DOM and add the `data-role="button"` attribute to each,
        //then end the current selection (returning to `$(this)`) and initialize all widgets
        $(this).find('a').attr('data-role', 'button').end().trigger('create');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following HTML on a Jquery Mobile Page: <div data-role=controlgroup data-type=horizontal class=panelSwitcher>
I have the following code: <div data-role=page id=Page1 > <!-- Footer here --> <div
I'm using a very standard one-page model for JQueryMobile development like: <div id=page1 data-role=page>Lorem
I have the following jQuery Mobile HTML code, the navbar's content is set using
In the master page I have the following code: <!DOCTYPE html> <html> <head> <meta
I have the following html code <!DOCTYPE html> <html lang=en> <head> <meta name=viewport content=width=device-width;
I have a login page using jQuery Mobile which contains the following code: <div
jQueryMobile: In a simple listview I have the following: <li><a>SOME TEXT</a></li> A data-icon of
I have the following code for a jquery mobile page. When I run it
I loaded the following HTML via Ajax into a web page powered by jQuery

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.