JQuery Select Box with Search using Select2 JS Example
We always like to choose good plugin for search option in select box. In this example i added select2.js, that provide select box with search option.
If you use select2.js, you don't require to add bootstrap js or css. It provides it's own js and css code. I give you full example of select box with search option. After run this example you will find bellow preview.
Preview:
Example:
<html lang="en">
<head>
<title>Jquery Select2 - Select Box with Search Option</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
</head>
<body>
<div style="width:520px;margin:0px auto;margin-top:30px;height:500px;">
<h2>Select Box with Search Option Jquery Select2.js</h2>
<select class="myselect" style="width:500px;">
<option>Laravel</option>
<option>Laravel ACL</option>
<option>Laravel PDF</option>
<option>Laravel Helper</option>
<option>Laravel API</option>
<option>Laravel CRUD</option>
<option>Laravel Angural JS Crud</option>
<option>C++</option>
</select>
</div>
<script type="text/javascript">
$(".myselect").select2();
</script>
</body>
</html>
You can get more information about select2.js plugin from here : select2.
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Disable Text Selection using JQuery?
- How to Remove Empty or Null Values from JSON using JQuery?
- How to Disable Browser Back Button using JQuery?
- How to Get Selected Checkbox Value from Checkboxlist using JQuery?
- How to Remove All Spaces from String in JQuery?
- Codeigniter JQuery Ajax Request Example
- Bootstrap Multiple Select with Checkboxes using Bootstrap-multiselect.js JS
- How to Disable Right Click Menu using JQuery?
- PHP JQuery Select2 Ajax Autocomplete Example
- JQuery Chosen Multi Select Dropdown Example
- JQuery Datepicker Example using JQuery UI JS
- JQuery Notification Popup Box using Toastr JS Example
- JQuery Select Box with Search Option using Chosen Plugin
- Bootstrap Dynamic Autocomplete search using Typeahead JS
- Multi Select Autocomplete JQuery Example with Code