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

  • Home
  • SEARCH
  • 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 9098849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:27:50+00:00 2026-06-17T00:27:50+00:00

I am populating a DIV with content returned from a callback that has multiple

  • 0

I am populating a DIV with content returned from a callback that has multiple HTML items in it and each have their own classes associated. After I call .append however the content isn’t coming in with the proper associated styles.

$.ajax({
    type: "GET",
    url: "blah.xml",
    dataType: "xml",
    data: myData,
    success: function(xml) {
        $(xml).find('item').each(function(){
            var id = $(this).attr('appId');
            $('<li><h5 class="thing">' + id + '</h5>').appendTo('#results');
        });
    }
});

So it grabs the ID and sets the ID in there on an H5 with the class “thing”, it then appends to the DIV results. That works fine, but the problem is when this happens the class named “thing” never gets applied. Its definitely there, but not getting rendered.

Any ideas?

  • 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-17T00:27:52+00:00Added an answer on June 17, 2026 at 12:27 am
    $('#results').append('<li><h5 class="thing">' + id + '</h5>');
    

    So, for many reasons, including performance reasons, and autoclosing of <ul>, etc, I suggest you first build your whole subtree as string.

    var s = '<ul>';
    $(xml).find('item').each(function(){
        var id = $(this).attr('appId');
        s += '<li><h5 class="thing">' + id + '</h5></li>';
    });
    $('#results').append(s + '</ul>');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple page (index.html) with a div: I am populating that div
I have a hidden div: <div id=termSheetPrinted style=visibility:hidden;> </div> that I am populating through
I have a large html string that I am populating with data and using
i am populating a form from mysql. code is. . task.php <div data-role=content> <h2>
I have a < div > in my aspx page which has some notification
I am pulling data from a database with Ajax and dynamically populating a div
I'm populating the results div with images from jsonp call. The images are displayed
I'm trying to create duplicate div s with different data in each obtained from
I have the following long string returned from a SOAP call into a variable,
I have my GridView populating like so: <asp:Panel ID=pnlGrid runat=server> <div class=m_container style=margin-bottom:20px;> <asp:GridView

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.