Support the ongoing development of →
Last updated 1 year ago.

You don't just install jQuery using npm and expect it work out of thin air, you also need to include it into your resources/js/app.js file or whatever it's called and add that file to your blade template:

<script src="{{ asset(mix('js/app.js')) }}" defer></script>

After you've done this, you pick what you want to do next. Either add inline JS below the included script or add your code inside app.js or in a separate file.


@geowrgetudor , thank you for responding. I have already included jquery in app.js like below

window.$ = require('jquery');

then, I run 'npm run dev' and put the app.js file in my layout file but still it's not working. below is the git repo where i have used this.


Does any of the following work in your app.js? Do they output test in the browser's console?


// case 1
$(document).ready(function() {

// case 2
jQuery(document).ready(function($) {
Solution selected by @amitleuva1987

@geowrgetudor , Thanks for giving this tracing tricks. it's working.


Sign in to participate in this thread!

Full Stack Europe

Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.