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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:15:58+00:00 2026-06-14T21:15:58+00:00

I am programmatically adding a li to a ul using JQuery and jQM The

  • 0

I am programmatically adding a li to a ul using JQuery and jQM
The following code works, it adds the li and a normal jQM looking button

$('#ul_edit_users')
   .append("<li>"+
      " <a href='#' data-role='button' data-theme='c'>Delete</a>"+
       "</li>");
$('#ul_edit_users').listview('refresh');

However when I add logic to split the LI into two rows, i lose the ‘button’ features and it just becomes a regular blue ‘href’.

$('#ul_edit_users')
.append("<li>"+
        "<div class='ui-grid-a'>"+
    " <div class='ui-block-a'>"+
    "  <h2 >Name</h2>"+
    " </div>"+
    " <div class='ui-block-b'>"+
    "  <a href='#' data-role='button' data-theme='c'>Delete</a>"+
    " </div>"+
    "</div>"+
    "</li>");
  $('#ul_edit_users').listview('refresh');

If I put that code into the file as regular html then it works fine, I think jquery isnt happy about adding it dynamically.

Any ideas very welcome, thanks.

  • 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-14T21:15:59+00:00Added an answer on June 14, 2026 at 9:15 pm

    You need to .trigger('create') on the new piece you are inserting to generate the buttons etc, then you .listview('refresh') to update the list.

    $('#add').click(function() {
        $new = $("<li><div class='ui-grid-a'><div class='ui-block-a'><h2 >Name</h2></div><div class='ui-block-b'><a href='#' data-role='button' data-theme='c'>Delete</a></div></div></li>");
    
        $('#ul_edit_users').append($new);
    
        $new.trigger('create');
    
        $('#ul_edit_users').listview('refresh');
    });
    ​
    

    http://jsfiddle.net/trapper/TyEDz/1/

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

Sidebar

Related Questions

I am using the code listed on the following link: http://www.magentocommerce.com/wiki/5_-_modules_and_development/catalog/programmatically_adding_attributes_and_attribute_sets Everything works until
When programmatically adding user controls using LoadControl(string path), when, in the user control's page
I've constructed a DataGrid by adding columns programatically using the following snippet: var check
I've implemented a custom index section list by programmatically adding buttons using a loop.
I have working code that opens up a word document programmatically using vbscript, makes
I'm programmatically adding a UISegmentedControl to my UINavigationBar as follows UISegmentedControl *toggleSwitch = [[UISegmentedControl
I just have a few questions about programmatically adding controls in aspx . After
I have a TabControl , to which I am programmatically adding a Form with
I'm adding TextViews programmatically in a for-loop and add them to an ArrayList. How
I'm currently adding a div to use as a slider programmatically, but when I

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.