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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:02:28+00:00 2026-05-25T03:02:28+00:00

Here’s a snippet of the JS: … $(this).load(‘html_fragment.html’, function(data) { console.log(data); $(data).find(‘.accordion’).accordion(); }); …

  • 0

Here’s a snippet of the JS:

...
$(this).load('html_fragment.html', function(data) {
    console.log(data);
    $(data).find('.accordion').accordion();
});
...

here’s the content of the document I’m loading (html_fragment.html):

<form>
    <div class="accordion">
        <h3><a href="#">Section 1</a></h3>
        <div>
            <p>
                Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
                ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
                amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
                odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
            </p>
        </div>
        <h3><a href="#">Section 2</a></h3>
        <div>
            <p>
                Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
                purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
                velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
                suscipit faucibus urna.
            </p>
        </div>
        <h3><a href="#">Section 3</a></h3>
        <div>
            <p>
                Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
                Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
                ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
                lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
            </p>
            <ul>
                <li>List item one</li>
                <li>List item two</li>
                <li>List item three</li>
            </ul>
        </div>
        <h3><a href="#">Section 4</a></h3>
        <div>
            <p>
                Cras dictum. Pellentesque habitant morbi tristique senectus et netus
                et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
                faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
                mauris vel est.
            </p>
            <p>
                Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
                Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
                inceptos himenaeos.
            </p>
        </div>
    </div>
</div><!-- end accordion -->


    <div id="horizontal">
        <p>horizontal test data</p>
    </div><!-- end horizontal -->
</form>

Problem?: the Jquery UI accordion function does not seem to work on the wrapped object after it’s been loaded. Is there a way perform JS on the returned html fragment during the callback?

  • 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-05-25T03:02:29+00:00Added an answer on May 25, 2026 at 3:02 am

    by the time you get to the line

    $(data).find('.accordion').accordion();
    

    is the html fragment in the DOM? if so then don’t find the accordinon in the data, find it in the DOM

    $('body').find('.accordion').accordion();
    

    use body or whatever your container is.

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

Sidebar

Related Questions

Here my code: $(document).ready(function() { $('#mid_select').live('click', function(e){ $('#middle').load( $(this).attr('href') + ' #middle'); var page
Here's my problem I have this javascript if (exchRate != ) { function roundthecon()
Here is what I want to do. Use this HTML line and have the
Here's a coding problem for those that like this kind of thing. Let's see
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here's my function: static Map AddFormation(Map _map, Tile tile, int x, int y, int
Here is my javascript code for a cursor focus function to go to username
Here is what I am trying to achieve in PHP: I have this string:
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>

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.