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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:50:33+00:00 2026-06-06T14:50:33+00:00

I have (basically) this code – <script type=text/javascript language=javascript> $(document).ready(function() { $(#loadDiv).load(mypage.html, function(){ alert($(#someText).text())

  • 0

I have (basically) this code –

<script type="text/javascript" language="javascript">
    $(document).ready(function() {
        $("#loadDiv").load("mypage.html", function(){ alert($("#someText").text()) });
    });
</script>
<div id="loadDiv"></div>

However the alert will display “undefined” since the html has not been rendered into the div yet.

I’ve seen this question – How to wait for jQuery's load function to render loaded content before executing callback function – and Jake’s answer is the best for my situation. On my actual page I have eight of these and with a two second delay there are still some of them running before the html is rendered.

Does anyone have a better suggestion than increasing the delay to silly times?

  • 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-06T14:50:34+00:00Added an answer on June 6, 2026 at 2:50 pm

    According to the documentation, the load method already waits for the content to be placed in the element before calling the function:

    “If a “complete” callback is provided, it is executed after
    post-processing and HTML insertion has been performed.”

    I have tested this, and it does find the loaded content in the element when the callback function runs.

    If it doesn’t work in your code, you are trying to do something other than what you have shown in the question.

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

Sidebar

Related Questions

I basically have this piece of code. char (* text)[1][80]; text = calloc(2821522,80); The
I have this delphi code that basically download a file (using Delphi 2010 +
Basically, I have somewhere in my main code where this line of code is
I have this horribly stripped delphi code that basically login to server, save cookie
I have this small piece of code that basically takes a list and runs
Basically I have this code. I am trying to simply update a div but
I have code that basically looks like this (it isn't actually object, but rather
I have this coding inside my java file . This code basically receives an
So I have this code. Basically it should be able to take a stock
So I have found this code here This basically lets me pull some data

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.