LoginSignup
23
10

More than 3 years have passed since last update.

Uncaught ReferenceError: $ is not defined【rails】

Last updated at Posted at 2018-05-29

jqueryはrequire_treeより前で読み込む

railsへjQueryを導入しようとしたところ、最初の$(function()でエラーが起きる。

$(function(){
//省略
})

//= require_tree .を最後に読み込むようにして解決👌

app/assets/javascripts/application.js
//
//= require jquery
//= require jquery_ujs
//= require rails-ujs
//= require_tree .
23
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
10