--- tags: PHP, Laravel, Jquery disqus: HackMD --- # How to use Chosen JQuery plugin on Laravel [chosen packagist](https://packagist.org/packages/harvesthq/chosen) ### 1. Install `composer require harvesthq/chosen` ### 2. Import Import jquery first, otherwise an error will occur ```htmlmixed= <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 ```htmlmixed= <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> ``` 4. Run code  5. Submit  Need more changes see [chosen doc](https://harvesthq.github.io/chosen/)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up