Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Metronic 9 laravel - Use jQuery CHOSEN plugin


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


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


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 jQuery in your app.js or wherever you need it:

import $ from "jquery";
window.$ = window.jQuery = $;


Option 2: Use a CDN
Add the following script tag before the Chosen plugin in your master.blade.php:

<script src="
<link rel="stylesheet" href="/assets/plugins/chosen/chosen.css" type="text/css">
<script src="/assets/plugins/chosen/chosen.jquery.js"></script>


After that, initialize the Chosen plugin properly:

$(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:


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(