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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:32:41+00:00 2026-06-17T06:32:41+00:00

I am trying to Create pages with DIVs dynamically for my phonegap app from

  • 0

I am trying to Create pages with DIVs dynamically for my phonegap app from the database with the query below.
To keep it simple for this the database will have only 2 columns, “ID” and “Data”:

function querySuccessOrders(tx, results) {
console.log("Successful QUERY of the Table");
var len = results.rows.length;

for (var i=0; i<len; i++){ 
    $('#body').append('<div data-role="page" id="coi'+results.rows.item(i).ID+'" data-theme="b"></div>');
}

for (var i=0; i<len; i++){  
    $('#coi'+results.rows.item(i).ID+'').append('<div data-role="header" data-theme="b" id="coi_header'+results.rows.item(i).ID+'"></div>');
}

for (var i=0; i<len; i++){  
    $('#coi'+results.rows.item(i).ID+'').append('<div data-role="content" data-theme="b" id="infoGuts'+results.rows.item(i).ID+'"></div>');
}

for (var i=0; i<len; i++){  
    $('#coi'+results.rows.item(i).ID+'').append('<div data-role="footer" data-position="fixed" class="footer-docs" data-theme="b" id="coi_footer'+results.rows.item(i).ID+'"></div>');
}

for (var i=0; i<len; i++){  
    $('#coi_header'+results.rows.item(i).ID+'').append('<h1>ID #'+results.rows.item(i).ID+'</h1>');
    $('#coi_header'+results.rows.item(i).ID+'').append('<a href="#page" data-icon="home" data-iconpos="notext" id="intro" class="ui-btn-right"></a>');  
}

for (var i=0; i<len; i++){  
    $('#coi_header'+results.rows.item(i).ID+'').append('<div data-role="navbar" data-theme="b" id="coi_navbar'+results.rows.item(i).ID+'"></div>');
}

  for (var i=0; i<len; i++){  
    $('#coi_header'+results.rows.item(i).ID+'').append('<div data-role="navbar" data-theme="b" id="coi_navbar'+results.rows.item(i).ID+'"></div>');
}

for (var i=0; i<len; i++){  
    $('#coi_navbar'+results.rows.item(i).ID+'').append('<ul>');
    $('#coi_navbar'+results.rows.item(i).ID+'').append('<li><a href="#COI'+results.rows.item(i).ID+'">COI</a></li>');
    $('#coi_navbar'+results.rows.item(i).ID+'').append('<li><a href="#COP'+results.rows.item(i).ID+'">COP</a></li>');
    $('#coi_navbar'+results.rows.item(i).ID+'').append('<li><a href="#COQ'+results.rows.item(i).ID+'">COQ</a></li>');
    $('#coi_navbar'+results.rows.item(i).ID+'').append('</ul>');
}

for (var i=0; i<len; i++){  
    $('#coi_footer'+results.rows.item(i).ID+'').append('<p>footer</p>');     
}

for (var i=0; i<len; i++){
    $('#info'+results.rows.item(i).ID+'').append('ID:'+results.rows.item(i).ID+'<br />');
    $('#info'+results.rows.item(i).ID+'').append('Data:'+results.rows.item(i).Data+'<br />');
}

}

Essentially I am trying to get the body to look like this dynamically:

    <body id="body">

<div data-role="page" id="coi1" data-theme="b">
    <div data-role="header" data-theme="b" id="coi_header1">
        <h1>ID #1</h1>
        <a href="#page" data-icon="home" data-iconpos="notext" id="intro" class="ui-btn-right"></a>
            <div data-role="navbar" data-theme="b" id="coi_navbar1">

                         <ul>
                           <li><a href="#COI1">COI</a></li>
                           <li><a href="#COP1">COP</a></li>
                           <li><a href="#COQ1">COQ</a></li>
                         </ul>
            </div>
    </div>
    <div data-role="content" data-theme="b" id="infoGuts1">
           ID:1<br />
           Data: asd <br />
    </div>
    <div data-role="footer" data-position="fixed" class="footer-docs" data-theme="b" id="coi_footer1">
     <p>footer</p>  
    </div>
</div>

<div data-role="page" id="coi2" data-theme="b">
    <div data-role="header" data-theme="b" id="coi_header2">
        <h1>ID #2</h1>
        <a href="#page" data-icon="home" data-iconpos="notext" id="intro" class="ui-btn-right"></a>
            <div data-role="navbar" data-theme="b" id="coi_navbar2">
                          <ul>
                           <li><a href="#COI2">COI</a></li>
                           <li><a href="#COP2">COP</a></li>
                           <li><a href="#COQ2">COQ</a></li>
                         </ul>              
            </div>
    </div>
    <div data-role="content" data-theme="b" id="infoGuts2">
            ID:2<br />
           Data: asd <br />
    </div>
    <div data-role="footer" data-position="fixed" class="footer-docs" data-theme="b" id="coi_footer2">
     <p>footer</p>  
    </div>
</div>

Doing this for each ID

</body>

The following are problems I am experiencing and after a while of goggling around cant find solutions to:

The Divs that are created loose there formatting(they lack the css)

The new divs seem to be mashed together (almost like I am creating the incorrectly) like the divs are not going into the correct spots like I have layed out in the body example.

Thanks for any 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-06-17T06:32:42+00:00Added an answer on June 17, 2026 at 6:32 am

    jQuery Mobile documentation is really bad regarding this case. If I understood you correctly you want to refresh a css on a fully dynamically generated page. jQM documentation states to use this syntax .trigger(‘create’) but unfortunately it is not working in jQM.

    In your case you should use this syntax:

    $("#index").trigger("pagecreate");
    

    And here’s an example for this solution: http://jsfiddle.net/Gajotres/mpFJn/

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

Sidebar

Related Questions

So I'm trying to dynamically create a folder inside the web pages folder. I'm
I am trying to create divs dynamically in a view page of an asp.net
I am trying to create dynamic pages without creating new files and getting the
I'm trying to allow admin to create pages on the root path. So far
I am trying to create a crawler that crawl first 100 pages on a
I'm trying to create two ASP.NET Membership login pages for an ASP.NET website I'm
I am trying to create a sessions and entry to pages based on a
I'm trying to create a page by using view 2. This page list all
I'm trying to create a row of divs with hidden images inside, when moused
I'm trying to create a page which looks somewhat like this: http://www.drmichaelbogdan.com/plastic-surgery/ (I'm referring

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.