skip to Main Content

webpack 5 & shakapacker 7: jQuery not being initialized

After upgrading webpack 4.46.0 to webpack 5.88.2 & shakapacker 7.0.3 (rails 6.1.7.6) got the Uncaught ReferenceError: $ is not defined error. Here the current setup: package.json { "name": "app", "private": true, "dependencies": { "@babel/runtime": "^7.22.15", "@fortawesome/fontawesome-free": "^6.4.2", "@hotwired/turbo-rails": "^7.3.0", "@popperjs/core":…

VIEW QUESTION

Jquery – Swap image div-by-div

Need to swap image and title div-by-div like below website example e-Zest Insights . Here image and title changing div-by-div - 1st image replacing second div image and 2nd div image replacing third div image and vice versa with each…

VIEW QUESTION

How to convert jQuery code to Pure JavaScript code?

I'd like to convert jQuery to Pure JavaScript but it doesn't work. jQuery: (document).ready(function() { $(".js-all-btn").on("click", this, function() { $(this).toggleClass("active"); $(".js-all-content").toggleClass("a-block"); } ); }); To Pure: document.addEventListener("DOMContentLoaded", function() { document.querySelector(".js-all-btn").on("click", this, function() { document.querySelector(this).toggleClass("active"); document.querySelector(".js-all-content").toggleClass("a-block"); }); }); Result: document.querySelector(...).on is…

VIEW QUESTION
Back To Top
Search