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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:11:39+00:00 2026-05-31T21:11:39+00:00

Super weird problem here. I’m having trouble getting jQuery to bind any selectors except

  • 0

Super weird problem here. I’m having trouble getting jQuery to bind any selectors except document, inside a .js file.

example code:

$(document).click(function () {
 $("#nav_primary").empty();
});

when I click anywhere, the nav_primary div empties, as expected, however, when I use this code:

$("div").click(function () {
 $("#nav_primary").empty();
});

nothing happens when I click. UNLESS I enter it into my console. When I paste the above code into my firebug console, it loads as expected, and clicking anywhere empties out the div as expected.

I know javascript and jquery are both running, as I have this in my js and it logs as expected:

console.log("js is running");
if (jQuery) {console.log('jQuery is loaded!');}

I’ve heard there are conflicts with prototype, but I don’t think i’m running it. here’s my head:

<head>
  <link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
  <script src="/assets/jquery.js?body=1" type="text/javascript"></script>
  <script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
  <script src="/assets/portfolio.js?body=1" type="text/javascript"></script>
  <script src="/assets/application.js?body=1" type="text/javascript"></script>
  <link href="/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
  <meta content="authenticity_token" name="csrf-param" />
  <meta content="(token here)" name="csrf-token" />
  <!--[if !IE 7]>
    <style type="text/css"> #main {display:table;height:100%} </style>
  <![endif]-->
  <!--[if lt IE 9]>
    <script src='//html5shiv.googlecode.com/svn/trunk/html5.js'></script>
  <![endif]-->
</head>
  • 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-31T21:11:40+00:00Added an answer on May 31, 2026 at 9:11 pm

    Stupid answer. but did you put your code in ready function

    e.g.

    $(function() {
    
        $("div").click(function () {
            $("#nav_primary").empty();
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I'm experiencing a super weird problem. Whenever I post links to my website
I'm running into a weird thingy here. I'm trying to add a JLabel inside
I am having a really weird problem because i get completely different results between
I yet again have a super weird problem. I get different outputs whether I'm
I'm experiencing a weird problem which I hope someone in here may be able
Im getting these weird errors, but I dont understand them. Here are the errors:
I'm having a weird problem. I have a div that is hidden via css
I'm getting a weird problem when refreshing my ListView , it works fine until
Is there a super quick way to bind to the inverse of a boolean
Brand new to android and facing a weird problem.Check out the code below FirstActivity.java:

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.