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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:45:47+00:00 2026-05-12T09:45:47+00:00

Something really weird is happening to my Rails app. For some strange reason, jQuery

  • 0

Something really weird is happening to my Rails app.

For some strange reason, jQuery does not recognise my id’s in the DOM.
Let me give you an example.

I have a JavaScript function as shown below:

<script>
    function myFunction(){
        $('#hello').toggle();
    }
</script>

Simple enough, it should toggle the element with the id=”hello”.
But it gives me a $("#hello") is null error. (Even though there is one in the view file)

But if I use $('hello').toggle() instead of $('#hello').toggle(), the expected behavior is observed.

Can somebody please tell me what is happening?

  • 1 1 Answer
  • 1 View
  • 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-12T09:45:47+00:00Added an answer on May 12, 2026 at 9:45 am

    Could it be that you (or some component) is adding the Prototype library to your page? In Prototype, you select by ID using $(‘id’) rather than $(‘#id’). Also, Prototype’s $() function will return null if it doesn’t find a match, while jQuery’s $() function will never return null.

    If Prototype (or another library with a $() function) is being loaded after jQuery, it would stomp all over jQuery’s version of the $() function.

    If it turns out this is the case, and you can’t avoid using both jQuery and the other library, you’ll probably want to take advantage of jQuery.noConflict.

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

Sidebar

Related Questions

Something really strange is happening after I updated to Rails 3.2.4. I create a
This is probably something really simple but for some reason I just can't seem
I think I'm missing something really obvious here... must be... but for some reason
Something really weird is happening: when I call foo(100*1.0f), somewhere along the line that
Something really weird is happening, it works when I document.write() outside the window.onload =
This is really weird, for some reason the Id of the ViewModel is being
Something really weird is happening on my website, there is an image that is
Something really strange is going on here. I bought a new Mac last week,
Probably something really simple, but I'm having some real trouble with it. I have
Having some really weird problem and as beginner with c++ I don't know why.

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.