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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:15:59+00:00 2026-06-04T18:15:59+00:00

UPDATE 1: Am I getting this problem because I am removing .BC1 before the

  • 0

UPDATE 1:

Am I getting this problem because I am removing .BC1 before the get_firm_summary(); can use it?

ORIGINAL QUESTION:

I’ve started this question over again as it wasn’t structured well and was causing lots of confusion.

Before I get started, I would like to point out that I am using jQuery 1.4

I have a function where I dynamically create a span tag within some HTML where the span tag looks something like this:

<span class='BC1'>some text here</span>

The HTML before .BC1 is inserted looks like this:

<div class="portlet_10">
    <div class="portlet_header_10"></div>
    <div class="portlet_sub_header_10">this is where the span gets inserted</div>
    <div class="portlet_content_10">this is the bit which should get cleared and appended with new data</div>
    <div class="portlet_footer_10"></div>
<div>

And it looks like this after .BC1 is inserted:

<div class="portlet_10">
    <div class="portlet_header_10"></div>
    <div class="portlet_sub_header_10"><span class="BC1">some text here</span></div>
    <div class="portlet_content_10">this is the bit which should get cleared and appended with new data</div>
    <div class="portlet_footer_10"></div>
<div>

I then have a click event for this .BC1 tag:

$('.BC1').live('click', function() {
    alert("clicked");
    $(this).closest('.portlet_10').find('.portlet_sub_header_10').empty();  
    get_firm_summary( $(this) );
});

The alert and finding the closest portlet_sub_header_10 and setting it to empty(); works, as the inserted .BC1 disappears. I am having a problem with the get_firm_summary( $(this) );

The function looks something like this:

function get_firm_summary( that ) {
    $.ajax({
        url: 'get_firm_summary.aspx?rand=' + Math.random(),
        type: 'GET',
        error: function(xhr, status, error) {
            console.log(status);
            console.log(xhr.responseText);
        },
        success: function(results) { 
            console.log( that.attr("class") );
            that.closest('.portlet_10').find('.portlet_content_10').empty().append( results );
        }
    });
}

Here the console.log works fine, but nothing happens to portlet_content_10.

Anyone know why this is happening?

  • 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-04T18:16:01+00:00Added an answer on June 4, 2026 at 6:16 pm

    The problem is because before you call get_firm_summary( $(this) ); you are calling empty() on the parent div of the clicked element. This is losing the reference to the element in the DOM, rendering any traversal functions impossible.

    Try this:

    $('.BC1').live('click', function() {
        get_firm_summary( $(this) );
    });
    
    // ajax:
    success: function(results) {
        // add new text
        that.closest('.portlet_10').find('.portlet_content_10').empty().append("FOO BAR");
    
        // remove clicked element
        that.closest('.portlet_10').find('.portlet_sub_header_10').empty();  
    }
    

    See this fiddle for a working example

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

Sidebar

Related Questions

Original Question mysql-server-6.0.10 I have this problem, I'm using the COMPRESS function to update
Update: I can't delete this question, because the answer has been upvoted, yet it
UPDATE : Since this question is getting some views, I figured I'd better highlight
I'm getting NaN. How can I do this and have it update every time
I just updated my ubuntu 11.10 to 12.04 and getting this problem, my android
When I do ... brew update I keep getting this error message ... From
I'm getting this error when trying to update a row in DB through stored
I am trying to do a terminal update and I keep getting this error,
I am trying to update code via Linq, but I am getting this error:
Just started learning PySide and is having problem with QTimer I have this #!/usr/bin/python

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.