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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:09:43+00:00 2026-06-04T01:09:43+00:00

Possible Duplicate: Can you have multiple $(document).ready(function() sections? Is it OK to have multiple

  • 0

Possible Duplicate:
Can you have multiple $(document).ready(function() sections?

Is it OK to have multiple calls to $(document).ready on the same page? If so how is the order that the code is run in resolved and does this have any implications

I am using jQuery in my rails app. I have several levels of javascript used through the application, all of which use jQuery.

For example I have some default code that fades out Flash Notices in my application.js
I have a projects.js file that is included in all Project model views, and I have a project/edit.js that is included only in the view rendered by the edit action.

In all three js files I am using:

$(document).ready
{
   //Do something
}
  • 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-04T01:09:44+00:00Added an answer on June 4, 2026 at 1:09 am

    It’s fine.

    The execution order will be in the same order they were used.

    First in First Out

    jQuery has an internal queue called readyList storing all the callbacks for the ready event. When you call the ready function with a callback is simply add it to the queue and fire the whole queue when the DOM is ready.

    Looking at the jQuery source code can tell you that easily:

    source code:

    // The deferred used on DOM ready
    readyList,
    ...
    ...
    
    ready: function( fn ) {
        ...
        // Add the callback
        readyList.add( fn );
    
        return this;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: jQuery - is it bad to have multiple $(document).ready(function() {}); Can you
Possible Duplicate: Multiple forms on ASP.NET page i have a doubt. can we place
Possible Duplicate: ASP.NET MVC - Can i have multiple names for the same action?
Possible Duplicate: Can Super deal with multiple inheritance? Python inheritance? I have a class
Possible Duplicate: jQuery attribute selector for multiple values I have this $('input:radio[name=foo]').change(function() { blah();
Possible Duplicate: Can I have multiple background images using CSS? Is it possible to
Possible Duplicate: Can I have multiple background images using CSS? I am making a
Possible Duplicate: Can Read-Only Properties be Implemented in Pure JavaScript? I have an Object
Possible Duplicate: C++ static virtual members? Can we have a static virtual functions? If
Possible Duplicate: Interfaces: Why can't I seem to grasp them? I have seen many

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.