I'm trying to get jQuery to work with Laravel 5.4. I installed jQuery with npm. I have two files in the same folder: app.js
and bootstrap.js
. From app.js
I import the file bootstrap.js
with:
`require('./bootstrap');
In bootstrap.js
I import jQuery with:
window.$ = window.jQuery = require('jquery');
Still in my blade view when I try:
<script>
$(document).ready(function () {
console.log('jQuery is working!');
});
</script>
I get a referene error telling me that "$ is not defined".
Any idea what I am doing wrong? Thank you in advance.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire