After running npm install jquery, what then? I have tried:
import $ from "jquery.js";
var $ = require("jquery.js");
This code is in my app.js file which is connected to my html. jQuery code I write has no affect on the DOM.
Just use it like this:
import $ from 'jquery';
$(function () {
// ...
});
If you use express add this as static route
app.use('/lib/jquery', express.static(path.join(__dirname, 'node_modules/jquery/dist')));
And load it in your html file:
<script src="/lib/jquery/jquery.min.js"></script>
Maybe you have to modify the pathes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With