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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:02:05+00:00 2026-06-10T17:02:05+00:00

Recently discovered the head.js library and boy am I happy with it, although I’m

  • 0

Recently discovered the head.js library and boy am I happy with it, although I’m still a bit confused about one thing.

From headjs.com:

The “DOM ready” event such as $(document).ready() is already fired when the scripts arrive. If the loaded scripts depend on that event make sure your library can handle this. jQuery 1.4+ works.

With this in mind, what is the best way to set up a page that uses jQuery if the code within $(document).ready() depend of the external scripts loaded with head.js?

Can we just lose the $(document).ready() call all together and still successfully set up things like event listeners which rely on the the document being ready? Ex:

head.js("script1.js", "script2.js", "script3.js", function() {
    $('#button').click(function(event) {
        alert("clicked");
    });
});

Or do we want to wrap $(document).ready() within the function?

Just wondering what the best practice is to ensure that everything is ready to go by the time it needs to be.

  • 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-10T17:02:07+00:00Added an answer on June 10, 2026 at 5:02 pm

    Either way is fine. Handlers passed to ready() are called immediately if the DOM is already fully initialized.

    For a small performance gain, you may want to remove the ready handler and include your code directly, unless you’re relying on a side effect like jQuery’s $ object being passed to the handler.

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

Sidebar

Related Questions

Having recently discovered design patterns, and having acquired the excellent Head First Design Patterns
We recently discovered a performance problem with one of our systems and I think
I'm learning C++ (coming from java) and recently discovered that you can pass functions
It's worked : http://jsfiddle.net/qYYm5/ I recently discovered Kinetic.js from here : http://www.kineticjs.com/ I tried
I recently discovered that one can copy over an assembly that is in use
I have recently discovered the excellent library boost::accumulators, and I would like to use
I recently discovered you can compile JScript into console apps using a built in
I recently discovered GWT-Platform (GWTP) and am loving the architecture. However, I'm finding that
I recently discovered that all Windows 7 machines have an handwriting recognition API within
I recently discovered that when you have a page set to session readonly and

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.