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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:04:24+00:00 2026-05-31T18:04:24+00:00

$(document).ready() – How it is being executed?. Whether the cursor will be waiting in

  • 0

$(document).ready() – How it is being executed?. Whether the cursor will be waiting in that piece of line in order to execute the code after DOM creation OR this method will be executed like event handler after the DOM has been created by the browser?

What if the image doesnt get downloaded but the $(document).ready() gets executed to read the that image’s src attribute to assign to some other local variable after the DOM construction?

  • 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-31T18:04:25+00:00Added an answer on May 31, 2026 at 6:04 pm

    It’s an event handler, and it doesn’t wait for everything to download. It only waits until the DOM has been constructed and is ready to be transformed. From the docs:

    While JavaScript provides the load event for executing code when a
    page is rendered, this event does not get triggered until all assets
    such as images have been completely received. In most cases, the
    script can be run as soon as the DOM hierarchy has been fully
    constructed. The handler passed to .ready() is guaranteed to be
    executed after the DOM is ready, so this is usually the best place to
    attach all other event handlers and run other jQuery code. When using
    scripts that rely on the value of CSS style properties, it’s important
    to reference external stylesheets or embed style elements before
    referencing the scripts.

    Code behind it is fairly simple, actually. It just waits for document.body to be accessible (not null):

    function (wait) {
        // Either a released hold or an DOMready/load event and not yet ready
        if ((wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady)) {
            // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
            if (!document.body) {
                return setTimeout(jQuery.ready, 1);
            }
    
            // Remember that the DOM is ready
            jQuery.isReady = true;
    
            // If a normal DOM Ready event fired, decrement, and wait if need be
            if (wait !== true && --jQuery.readyWait > 0) {
                return;
            }
    
            // If there are functions bound, to execute
            readyList.resolveWith(document, [jQuery]);
    
            // Trigger any bound ready events
            if (jQuery.fn.trigger) {
                jQuery(document).trigger("ready").unbind("ready");
            }
        }
    }
    

    From http://james.padolsey.com/jquery/#v=1.6.2&fn=jQuery.ready

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

Sidebar

Related Questions

On document ready I run this code: jQuery(document).ready(function(){ jQuery('#button').click(function() { jQuery('#contact_form').load(/Users/mge/Downloads/jquery-ajax-1/readme.txt); return false; });
$(document).ready(function(){ $('#hideButton').click(function(){ $('#disclaimer,#clock').hide(); }); }); In the above code snippet, suppose I want to
jQuery(document).ready(function ($) { $('body').keypress(function (e) { alert(e.which); }); }); This will pop up an
How document.ready event is implemented in jQuery. I mean whether they have used defer(which
$(document).ready( $(#machType).each(function() {$(this).replace('machine1 (windows)', 'Windows Machine 1');})); ; Is that snippet above correct for
$(document).ready(function() { IncomeDetails.initIncomeForm(); }); The above code is written in XSL File. Can anybody
$(document).ready(function () { $(td:contains('1')).addClass('isOne'); }); I tried above code, but it also selects 11
$(document).ready -> $('#auto').autocomplete( source: main/search ) the code beyond set up the autocomplete env,'#auto'
$(document).ready(function(){ $(#changeText).click(function() { $(#textBox).html(text text); }); }); How make that if i push on
$(document).ready(function() { $(span.link).mouseover(function(e){ $(this.children).css(display,inline); }); }); I'm not a javascript expert, but I've cobbled

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.