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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:09:57+00:00 2026-05-31T16:09:57+00:00

I have included Javascript with <%= javascript_include_tag application %> in my Rails 3.2 application.

  • 0

I have included Javascript with <%= javascript_include_tag "application" %> in my Rails 3.2 application. And, I have included the following CoffeeScript in the company.js.coffee file that is included in the final application.js file when run:

$("article h2 a").click (e) ->
    $("article div").hide()
    $(@hash).slideToggle()
    e.preventDefault()
$("article div:not(#1)").hide()

However, the script doesn’t work at all, despite functioning in the original HTML file that it was copied from (albeit not in CoffeeScript). And, similarly, the AJAX form requests don’t seem to be working either.

Does anyone know why this may be occurring? Is there something I’m missing?

  • 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-31T16:09:58+00:00Added an answer on May 31, 2026 at 4:09 pm

    I finally found the answer (something I should have tried first). I assumed that rails was automatically including the $ -> opener in the application.js file when it included the other files in the asset folder. But it seems that you need to do it for each one. So, I just added $ -> before everything and it works now.

    And a note for others reading with the same problem, be sure that the $ selector isn’t being used by any other functions, else you’ll need to do the full CoffeeScript JQuery function reference.

    Thanks for all of the help!

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

Sidebar

Related Questions

I have a HTML that includes a Javascript file. This script contains a special
I have an rails a application whereby it has a page that contains a
I have a problem in my rails app that jQuery is included twice. Once
I have added this to my config/application.rb file: config.action_view.javascript_expansions[:defaults] = %w(jquery rails application) and
Is there a way to have Expression Language (EL) expressions included JavaScript files be
I have a NetBeans javascript project with several included paths for plugins. I do
I have a site on domainA.com. It includes file.js from domainB.com: <script type=text/javascript src=http://www.domainB.com/file.js></script>
I'm running Rails 3.1.1, RSpec 2.7.0 and HAML 3.1.3. Say I have the following
I have an anchor tag in my application that has the sole purpose of
My question is about thinking through Rails app. I have a rich ajax-application which

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.