I'm a newbie ruby on rails developer. I've just created my first application and made use of the the bootstrap
carousel. Now, I want to add some javascript
. My application does not have any custom javascript
at this point. What I want to do is when the left
or right
button on the carousel is pressed, I want an alert
to pop up. Preferably, I want to include my javascript
file in the /assets/javascript
directory. The purpose of this is to just learn how to add new javascript
files in my application.
Adding your custom javascript to your rails app is real easy, just follow the steps below :-
For Rails 6
Add your javascript code under /app/javascript//file.js
and then in app/packs/application.js
require("<folder name>/file")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With