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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:20:57+00:00 2026-06-05T05:20:57+00:00

This is a weird situation. Despite making sure that all of its dependencies are

  • 0

This is a weird situation. Despite making sure that all of its dependencies are loaded before it (in my case it’s only jQuery library), my script doesn’t work when loaded in the head section (i.e. <head>), but does its job when loaded in the footer (somewhere above </body> tag).

Since that’s not clear enough, let me give a live example. This is the web page. Now, view the source of the page, and in there, this is the code I am talking about.

<script type='text/javascript'>
/* <![CDATA[ */
var yjlSettings = {"gifUrl":"http:\/\/whatthenerd.com\/wp-content\/themes\/reddlec\/images\/ajax-loader.gif","autoGrow":"enable"};
/* ]]> */
</script>
<script type='text/javascript' src='http://whatthenerd.com/wp-content/themes/reddlec/js/no-reload-comments.js?ver=3.3.2'></script>

What it’s supposed to do is allow users to post comments without reloading the page. (Please feel free to test comment on the page :) ) — but it’s doesn’t. Why?

PS: Like I said earlier, everything works when the aforementioned scripts are loaded just before the </body> tag. I don’t really see what could be causing the conflict.

  • 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-05T05:20:59+00:00Added an answer on June 5, 2026 at 5:20 am

    Your script goes immediately out to find elements in the DOM:

    var $commentlist = jQuery('.commentlist');
    var $respond = jQuery('#respond');
    

    Two examples found within the script. These items don’t exist at the time the header is being loaded, but they do exist by the time the end of your body is reached. If you want to load this from your header, you need to wrap this in a document ready block:

    jQuery(document).ready(function($) {
      // Code using $ as usual goes here.
    });
    

    This makes it safe to load at the top of your page by delaying the execution of your code until the document has fully loaded, and the DOM is constructed.

    More about ready online at: http://api.jquery.com/ready/

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

Sidebar

Related Questions

I have this weird situation that i have encountered for the first time and
I'm having a weird situation that I'm trying to understand. This piece of code
I have a really weird situation (may be its for me only). I developed
Howdy all, I have a weird situation. I have a C++ code that overloads
I have this weird situation where I want to restrict an action to only
I have a weird situation. A client of mine has a website having this
Hi this may seem like a weird question, but here's my situation: I have
Ok, this situation is a little weird but anyway. This PHP code generates several
I am refreshing openmp a bit, and got into this weird situation. Shaved off
I am having a weird Situation with my DataConext. All My code is in

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.