Add jQuery in Phoenix 1.5 without fatigue

Jquery
...
new webpack.ProvidePlugin({
$: "jquery", jQuery: "jquery"})
...
import $ from "jquery"global.$ = global.jQuery = $;
$(".login-menu").click(function (e) {console.log("it works! ")})
Error due to defer tag in script tag
<head>
...
<script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
...
<script type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
<script async defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>

--

--

--

Depths of ocean could not swallow me.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

TCM and Array.reduce and functional programming paradigm

Build a simple blog with Cockpit CMS and React JS (Part 2)

Removing FOUC in a Gatsby Project

Getting documents from Firestore in Front end

Creating a poster-making tool (part 1)

Editable Data Table using Lightning Web Components

Editable Data Table using Lightning Web Components

Google Sign-In with React Native and Expo: IOS & Android 2021

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sis Ccr

Sis Ccr

Depths of ocean could not swallow me.

More from Medium

Space Shooter: Switch Statements and Speed Boost

What are the Risks of using a public Wi-Fi?

Risks of using public wifi

Understand IoT Connectivity in 3 min

Podman — The new age Containerization Tool