I'm a little addicted, so make a note
$ ('# hoge') didn't work when I called js.erb on a controller that received the
remote: true form of a Rails 6 view.
JS error occurred: ʻUncaught ReferenceError: $ is not defined`
... require("bootstrap") require("admin-lte") window.$ = jQuery; //here!
$('.modal_area').html('<%= j(render "modal") %>'); $('#modal').modal('show');
I had a similar definition in config / webpack / environment.js, but I needed this description to use it from within the js.erb file.