Skip to content

jquery-rails doesn't work correctly in Rails 7 #291

Open
@infernaLwizarD

Description

@infernaLwizarD

Hello, I started to use Rails 7 with importmap and faced the following problem: jquery-rails doesn't work correctly. When I try to use jquery on the page, an error appears:
Uncaught ReferenceError: $ is not defined
Because of this, I had to remove the gem and added files manually to vendor/javascript folder. Then in application.html.erb I added jquery.min like this:

  <%= javascript_include_tag 'jquery-3.6.0.min', 'data-turbo-track': 'reload' %>
  <%= javascript_importmap_tags %>

And after that the error was gone, but I would like to use the gem again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions