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

Shall we integrate Cypress.io with Safari Browser..🤔

How to Create hello world react application?

Vue.js (cli3) : Difference between calculated properties and observers (Part.

Django!

Mocking AWS-SDK Service Object Instances That Instantiated In The Global Scope

“Hello, World” in IBM Cloud Functions vs Express Serverless Platform — A Developer’s Perspective

Callback function expressions passed as parameters using hooks

Use Recursion to Divide and Conquer Algorithmic Problems

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

Event-Driven Rock Pushing in RPG Maker MV/MZ

Why Password Managers Ignore Input Fields — trial:by:fire

.toBe or .toEqual?

What is CSR v SSR v SSG v ISR?