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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:26:30+00:00 2026-05-18T04:26:30+00:00

I previously asked a question over on Pro Webmasters about putting Javascript at the

  • 0

I previously asked a question over on Pro Webmasters about putting Javascript at the bottom of the HTML when using jQuery’s $(document).ready(). The answer was that JS has to wait for the entire DOM to load anyway so it makes no difference where the JS code goes.

However, in practice this doesn’t seem to be the case. I’m using a table sorting plugin and when loading a page with the jQuery at the bottom, I first see the unsorted table. Then the JS kicks in, sorts the table and adds arrows to the headers (which changes the table width too). It’s similar to the “FOUC” (Flash of Unstyled Content) that used to happen a lot with CSS.

With jQuery at the top of the page, the page loads with the table sorted and there is no jumping around.

Why does this happen? Is the only solution to keep the JS at the top, regardless?

  • 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-18T04:26:31+00:00Added an answer on May 18, 2026 at 4:26 am

    This is happening because between the document is ‘ready’ once all of the elements have been placed in the DOM but not necessarily once they have all fully loaded. When the library is in the <head> tag it is loaded before being inserted into the DOM but if it’s in the <body> tag it is still loading when the document is ready.

    So even though the document becomes ready it still has to fully load the libraries and execute the required code, which seems to take longer than if it’s in the head tag. In truth: it happens either way, but it’s more noticeable this way.

    To prevent the discrepancy: style the javascript-free version of the page the same (or as close to the same as possible) as the javascript version.

    (view ready() reference)

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

Sidebar

Related Questions

I asked a similar question about this previously, but I did not specify that
Refering to a previously asked question , I would like to know how to
This question builds off of a previously asked question: Pass by reference multidimensional array
I previously asked a question regarding MX records (and appreciate the thoughtful answers I
This is in reference to the question previously asked The problem here is, each
Previously, I asked the question . The problem is the demands of our file
In a previous question, I asked about various ORM libraries. It turns out Kohana
Ok, i've read most relevant questions asked here previously on this but I still
this question is an extension to a previous question i asked (and was answered).
I'm quoting myself on a previous question I asked to further explain: I'm trying

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.