How to connect javascript files in Rails application?

Sharma Nikhil 1 Reputation point
2022-12-19T13:21:26.317+00:00

I am writing a simple Ruby on Rails training application and using semantic-UI CSS framework. From the dropdown menu need to write a little code for jquery. If I write .js code directly in HTML code, it works. If I put it in a separate file app/assets/javascripts/dropdown.js this code stop working. But! If use .coffee, the code works again! How to connect js files to Rails?

So, i have javascript/dropdown.js. I tried to include it in an application.js file, and although this is not necessary, it did not work. I write this code directly in application.js - not work

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
986 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.