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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:48:47+00:00 2026-05-17T18:48:47+00:00

How do you set up jQuery to work with rails. I specifically want to

  • 0

How do you set up jQuery to work with rails. I specifically want to use the accordion feature. I have used this before with PHP but i cannot work out where everything needs to go in a rails application. I have imported jQuery into the javascript folder and included it in the application. My HTML is laid out correctly, but i don’t understand where the following should go:

<script>
  $(document).ready(function() {
    $("#accordion").accordion();
  });
</script>

I have also tried installing jRails and using the scriptaculous Accordion, but neither of them worked either, so I think I am missing some vital link between javascript and rails.

I have looked all over for some explicit instructions on how to set it up, if anyone has a link or can walk me through it it would be appreciated.

After checking firebug I can see I am getting the following error:

$("#accordion").accordion is not a function

I call jQuery before I call application.js

  • 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-17T18:48:47+00:00Added an answer on May 17, 2026 at 6:48 pm
    1. I downloaded the wrong jQuery library, the link on the website pointed to an incomplete .js file. Download what you need from: http://jqueryui.com/download don’t just download the file from http://docs.jquery.com/Downloading_jQuery
    2. Only call the javascript files you need directly in your standard layout, do not use the :defaults option.
    3. If you are going to use a lot of fancy jQuery things on different pages add the document ready function to your view, else add it to your application.js
    4. Ensure that you call the jQuery UI files before the application.js file or it will not find the functions in the right order.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to set page backgroudImage using jQuery. I wrote this code but it
So, I want to use jquery to set the text of a button, depending
I have a set of divs that I want to make collapsible/expandable using jQuery's
I have a problem with this jQuery code. It doesn't work as expected: $('#select_dropdown').change
I have this strange problem in JQuery. I try to set a value to
I used jQuery to set hover callbacks for elements on my page. I'm now
I have a JQuery silder that I'm using to set the score on a
I've set up a number of accordions on a page using the jquery accordion
I am using jQuery ui in a rails application. I want to load content
I have implemented the JQuery UI tabs and they work great, except for one

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.