Hi everyone i've been using rails 7.1.3 and i faced some problem in javascript side where application.js does compile my jquery please if you can help me about that i will be greatfull iv'e been using rails 7.0.5 and i didn't have any issue byt for rails 7.1.3 the application.js the jquery part is not executed thanks enter image description hereenter image description here[enter image description here(https://i.sstatic.net/t6DNL.png)iv'e tried to use script javascript inside html and it's work fine but i need to execute application.js with jquery thanks
You need to pin
your files and then import
them:
# config/importmap.rb
pin_all_from "app/javascript/custom", under: "custom"
// app/javascript/application.js
import "custom/main"
https://stackoverflow.com/a/72855705/207090
For jquery, here is how to set it up:
How can I install jQuery in Rails 7 with importmap?
Also, I'd suggest you stop with the inline scripts as well.