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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:21:12+00:00 2026-06-02T11:21:12+00:00

I have some javascript which controls a hidden div. Now it works on most

  • 0

I have some javascript which controls a hidden div. Now it works on most pages, but on other pages with other javascripts it is not working… Is my js written poorly?

$(document).ready(function() {
$("#user-dropdown-toggle").live ('click', function() {
    $("#left-user-bar").addClass("open");
    $("#user-dropdown-toggle").addClass("league-judgement");
    $("body").addClass("league-judgement");
});
$(".league-judgement").live('click', function() {
  $("#left-user-bar").removeClass("open");
  $("#user-dropdown-toggle").removeClass("league-judgement");
  $("body").removeClass("league-judgement");
});
});

Firefox is reporting the following in the error console:

Timestamp: 4/18/2012 9:08:21 PM
Error: $(“#user-dropdown-toggle”) is null

  • 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-02T11:21:14+00:00Added an answer on June 2, 2026 at 11:21 am

    The $ function in jQuery will never return null. So it is likely it is a different non-jQuery $ in use. (Is there any ASP.NET stuff or prototype.js or other library being used? A custom $ function declared later on?)

    I know that $ is itself not null because the exception would be different, such as: “$ is not a function”. In this case the browser is saying the result of the expression ($(...)) is null, which leads me to the above conclusion.

    Try:

    $(document).ready(function($) { // <-- note $ there
       ...
    });
    

    Or, better yet, as it only relies on window.jQuery and not window.$:

    jQuery(function($) { // <-- note $ there
       ...
    });
    

    And, if that works, then it is that $ is being clobbered before the “ready” event (but after $(...).ready). Of course, it is possible (but not very likely) that the $ is already not jQuery at this point…

    To see if $ is jQuery (use the Web Developer Console or Firebug):

    • $ === jQuery should generally be true, but it might not be depending on noConflict and such
    • $.fn.jquery and $().jquery should both result in the jQuery version as a string
    • $ (just specifying the function on the console will “display the source”)

    As an aside, I would indent the function body (e.g. in the “ready” callback) to see where it start/ends more clearly.

    Happy coding.

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

Sidebar

Related Questions

i have some javascript roll over code that works fine in firefox but when
Hi I have a usercontrol which includes some JavaScript, if I add the control
I have some javascript which catches changes to a form then calls the form's
I have some javascript which I want to convert to jQuery... I thought it
I am using some pre-written JavaScript from polldaddy. They have a JavaScript option which,
I have a javascript function which needs to do a numerical calculation. Some of
I have some JavaScript code that works in IE containing the following: myElement.innerText =
I am developing a javascript application which - among a lot of other controls
I have two aspx pages i.e. default1.aspx and default2.aspx. Default1 contains some controls, tables
I am having an ASP.WebSite in which I have added some form controls dynamically

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.