How to use Chosen JQuery plugin on Laravel

chosen packagist

1. Install

`composer require harvesthq/chosen`

2. Import

Import jquery first, otherwise an error will occur

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/harvesthq/chosen/gh-pages/chosen.jquery.min.js"></script>
<link
href="https://cdn.rawgit.com/harvesthq/chosen/gh-pages/chosen.min.css"
rel="stylesheet"
/>

3. add form

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/harvesthq/chosen/gh-pages/chosen.jquery.min.js"></script>
<link
href="https://cdn.rawgit.com/harvesthq/chosen/gh-pages/chosen.min.css"
rel="stylesheet"
/>

<script>
$(document).ready(function () {
$(".chosen-select").chosen({
no_results_text: "Oops, nothing found!",
});
});
</script>

<form action="http://httpbin.org/post" method="post">
<select
data-placeholder="select your favorite fruit"
multiple
class="chosen-select"
name="fruit[]"
>
<option value=""></option>
<option>Apple</option>
<option>Banana</option>
<option>Cherry</option>
<option>Kiwi fruit</option>
<option>Mango</option>
<option>Orange</option>
<option>Papaya</option>
<option>Sapota</option>
</select>
<input type="submit" />
</form>
  1. Run code

  1. Submit

Need more changes see chosen doc