Preparing to introduce jQuery to Ruby on Rails

Environment / Prerequisites

macOS Catalina version 10.15.4 ruby 2.5.1p57 (2018-03-29 revision 63029) Rails 5.2.4.3

jQuery introduction preparation

Check the Gemfile and

gem "jquery-rails"

It is described as.

In application.js,

//= require jquery 

It is described as. * As a caveat, write above "// = require_tree."

//= require jquery

//= require_tree .

Check if jQuery can actually be used. Create a js file with any name. (If there is a coffee file with the same name, delete it.)


$(function(){
 console.log('OK');
});

Now refresh the page and if the console says'OK', you're ready to go!

Recommended Posts

Preparing to introduce jQuery to Ruby on Rails
How to use Ruby on Rails
How to introduce jQuery in Rails 6
Deploy to Heroku [Ruby on Rails] Beginner
[Ruby on Rails] How to use redirect_to
[Ruby on Rails] Button to return to top
Ruby on Rails Elementary
Ruby on Rails basics
Ruby On Rails Association
Deploy to Ruby on Rails Elastic beanstalk (EB deploy)
[Introduction] Try to create a Ruby on Rails application
Method summary to update multiple columns [Ruby on Rails]
Ruby on rails learning record -2020.10.03
[Ruby on Rails] How to write enum in Japanese
Portfolio creation Ruby on Rails
Ruby on rails learning record -2020.10.04
Ruby on rails learning record -2020.10.05
Ruby on rails learning record -2020.10.09
[Ruby on Rails] How to change the column name
[Updated from time to time] Ruby on Rails Convenient methods
[Ruby on Rails] Change URL id to column name
Ruby on rails learning record-2020.10.07 ②
Deploy to Ruby on Rails Elastic beanstalk (Environment construction)
[Ruby On Rails] How to reset DB in Heroku
Ruby on rails learning record-2020.10.07 ①
Cancel Ruby on Rails migration
Ruby on rails learning record -2020.10.06
[Ruby on Rails] From MySQL construction to database change
(Ruby on Rails6) How to create models and tables
Ruby on Rails validation summary
Ruby on Rails Basic Memorandum
Deploy to Ruby on Rails Elastic beanstalk (IAM permission change)
<Dot installation> Introduction to Ruby on Rails5 Source code comparison
How to display a graph in Ruby on Rails (LazyHighChart)
[Ruby on Rails] Column restrictions when saving to DB (4 representatives)
Apply CSS to a specific View in Ruby on Rails
[Ruby on Rails] Read try (: [],: key)
Preparing to create a Rails application
Ruby on Rails variable, constant summary
Installing Ruby + Rails on Ubuntu 18.04 (rbenv)
Basic knowledge of Ruby on Rails
Progate Ruby on Rails5 Looking Back
How to deploy Bootstrap on Rails
Until you introduce fonts to Rails
Ruby on Rails Japanese-English support i18n
(Ruby on Rails6) "Erase" posted content
[Ruby on Rails] CSV output function
Ruby on Rails 6.0 environment construction memo
[Ruby on Rails] Confirmation page creation
Ruby On Rails devise routing conflict
[Ruby on Rails] Comment function implementation
[Ruby on Rails] DM, chat function
Deploy Rails on Docker to heroku
[Ruby on Rails] Convenient helper method
[Ruby on Rails] Stop "looping until ..."
Ruby on Rails --From environment construction to simple application development on WSL2
I want to add a browsing function with ruby on rails
Things to remember and concepts in the Ruby on Rails tutorial
Steps to build a Ruby on Rails development environment with Vagrant
[Ruby on Rails] How to avoid creating unnecessary routes for devise
(Ruby on Rails6) Create a function to edit the posted content