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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:25:03+00:00 2026-05-29T17:25:03+00:00

I want to disable some specific feature that one my plugins does to the

  • 0

I want to disable some specific “feature” that one my plugins does to the DOM when the DOM is ready.

If I put my code inside the onload callback, will it always get executed after the ready callback?

I want to be sure in 100% that even if there aren’t any images of just few the ready will be executed before the onload.

  • 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-29T17:25:05+00:00Added an answer on May 29, 2026 at 5:25 pm

    While I think @jAndy’s answer is right, you can afford yourself some extra assurance by also placing the code in the onload within a ready() call.

    Just make sure that your main ready() call comes first.

    $(document).ready(function() {
        // Your normal ready handler
    });
    
    $(window).load(function() {
        // Placing code in another .ready() call in here will add it to the
        //    end of internal Array of ready handlers if any are pending
        $(document).ready(function() {
            // my onload code
        });
    });
    

    So if the ready() has already fired by the time the onload fires, your onload code will still run. (An internal flag is set once the DOM is ready, so future .ready() calls are immediately invoked.)

    If the .ready() has somehow not fired when the onload happens, that will mean that your original ready() code is first in the internal Array, and the new .ready() code will be added to the end of the Array.


    EDIT:

    Looking at the source for the main jQuery.ready handler that is fired when the DOM is ready (which in turn, fires the list of the user’s .ready() handlers), it appears as though there’s an IE bug where the handler fires a little early.

    To remedy this bug, jQuery makes the handler asynchronously invoked until it can actually see document.body.

    
    ready: 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.fireWith(document, [jQuery]);
    
            // Trigger any bound ready events
            if (jQuery.fn.trigger) {
                jQuery(document).trigger("ready").off("ready");
            }
        }
    },
    

    It would seem that because of this asynchronous looping of the handler, then IE would at least be possibly prone to having the window.onload handler invoked before the .ready() handlers.

    Adding to the .ready() handler list within the onload as I described above should remedy this.

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

Sidebar

Related Questions

I often run into the situation where I want to disable some code while
I want to disable a specific warning (W1035) in my code, since I think
What are some reasons why I wouldn't want to disable IIS logging completely for
i have some user control and i want to disable Alt + F4 oportunity
I want to write some VBA script so that when I start my access
I have a button that I want to disable as long as there isn't
I have a CListCtrl with checkboxes. I want to be able to disable one
Hi I want to disable some items of the textbox like Right to left
I have a simple form with some radio buttons. I want to disable some
I start doing some things on multiple threads and I want to disable the

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.