Hello,
I would like add jquery CHOSEN plugin to my metronic project with Laravel, i can't do it.
I have donwload the plugin and placed it in the directory /public/access/plugins.
I have include it in master.blade.php like this :
<link rel="stylesheet" href="/assets/plugins/chosen/chosen.css" type="text/css">
<script src="/assets/plugins/chosen/chosen.jquery.js"></script>
It doesn't work, i h va an error in the console :
Uncaught ReferenceError: jQuery is not defined
I'm desperate because ireally need this library in my project, coul you help me to include this library properly ?
Thanks
Hi Fabien,
In Metronic v9, jQuery is not included by default. You’ll need to install it yourself to use the Chosen plugin.
You can add jQuery to your project by installing it via npm or including it from a CDN. Here's how you can do it:
Option 1: Install with npm
Run the following command in your project directory:
npm install jquery
import $ from "jquery";
window.$ = window.jQuery = $;
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="/assets/plugins/chosen/chosen.css" type="text/css">
<script src="/assets/plugins/chosen/chosen.jquery.js"></script>
$(document).ready(function() {
$(".chosen-select").chosen();
});
(I'm not part of Metronic team... just trying to help)
there is no jQuery bundled in Metronic 9.
you need to add it by yourself, eighter adding the JS file to your assets folder or using a CDN.
See: https://releases.jquery.com/