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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:04:54+00:00 2026-05-26T09:04:54+00:00

I’m attempting to load different content into a div, the refresh code I have

  • 0

I’m attempting to load different content into a div, the refresh code I have is quite similar to this: http://jsfiddle.net/TbJQ3/6/ but is more complex, it takes padding and magin etc into account.

The difference is that in my actual code, I used .load() to feed the content into my div rather than empty() and append().

When my page first loaded, I call my resizeContainer() function to render my layout dynamically set the size of my DIVs, everything looks good. I looked at firebug and this is what I got (all the sizes are there, set by my function):

<div id="divWrapper" class="fullscreen">
  <div id="divTop" class="Top " style="height: 0px;"> </div>
    <div id="divContainer" class="Container round" style="width: 1024px; height: 560px;">
      <div id="divContent" class="Content round" onclick="javascript: jQfn.testclick();" style="width: 701px; height: 542px;"> Content </div>
      <div id="divQuery" class="Query round" onclick="javascript: jQfn.testclick();" style="width: 292.2px; height: 558px;"> Query </div>
      <div id="divStatus" class="Status " onclick="javascript: jQfn.testclick();" style="width: 701px; float: left;"> Status </div>
    </div>
</div>

I made a test function to basically swap the content just to test the concept out…

jQfn.testclick = function(){
  if (jQ.busy == true) {
     console.log('Using busy.jsp');
     jQ('#divContainer').load('busy.jsp');
     jQ.busy = false;
  } else {
     console.log('Using login.jsp');
     jQ('#divContainer').load('login.jsp');
     jQ.busy = true;
  }
  jQ(window).trigger('resize');
}

However, if i click it twice just to swap it back to the original content, my resizeContainer function won’t render anything at all.

I’ve been hammering this problem for the past 5+ hours now, I tried to use:

  • empty, append
  • detach
  • calling the resize function in many different ways
  • calling my custom resizeContainer function in many different ways
  • combination of all of the above and some more

I noticed that after i loaded my content, jQuery was unable to find the divs that got reinserted anymore… which would explain why my resizeContainer function couldn’t set the width and height properly… But why? I could see it on the div on the screen as well as in the firebug…

This is what I see after i swap the content, obviously the styles is not present, as my custom resizeContainer function couldn’t find the div.

<div id="divWrapper" class="fullscreen">
  <div id="divTop" class="Top " style="height: 0px;"> </div>
  <div id="divContainer" class="Container round" style="width: 1024px; height: 560px;">
    <div id="divContent" class="Content round" onclick="javascript: jQfn.testclick();"> Content </div>
    <div id="divQuery" class="Query round" onclick="javascript: jQfn.testclick();"> Query </div>
    <div id="divStatus" class="Status " onclick="javascript: jQfn.testclick();" style="width: 701px; float: left;"> Status </div>
  </div>
</div>

The reason why I know jQuery couldn’t find my divs, is because I used the following code, and it logged some empty element:

var content = jQuery('#divContent');
console.log(content);

What could be wrong? I even tried to manually detach those DIVs before loading in the new content.

  • 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-26T09:04:55+00:00Added an answer on May 26, 2026 at 9:04 am

    Load is an Ajax method, and inserts content from external files, when using ajax methods and not the append methods you will in most cases have to use jQuery’s live(); to gain access to the inserted DOM elements.

    Once the content is inserted the first time with Ajax, try using detach and one of the append methods instead of Ajax to reinsert it, otherwise it will not work, as load just reinserts new DOM elements, and not the content you just detached.

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

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

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.