I used select2 to produce my select option list like the snippet below.
$(function(){
$(".select2").select2();
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.4/css/select2.min.css" rel="stylesheet"/>
<div class="form-group">
<label>Minimal</label>
<select class="form-control select2" style="width: 100%;">
<option selected="selected">Alabama</option>
<option>Alaska</option>
<option>California</option>
<option>Delaware</option>
<option>Tennessee</option>
<option>Texas</option>
<option>Washington</option>
</select>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.4/js/select2.min.js"></script>
What I want is, a subtext below the main text that searchable too. when i want to search the option with value Alabama, I just need to type Okay1, but in the other hand I want to search with value Alabama only. Are there any plugins other than select2 option library that support this kind of behavior ? ( Below is the image that i expected for the result )
I have tried like the code below, but it didn't work that well :
<div class="form-group">
<label>Minimal</label>
<select class="form-control select2" style="width: 100%;">
<option selected="selected">Alabama  <h4 style="color: grey">Okay1</h4></option>
<option>Alaska  <h4 style="color: grey">Okay2</h4></option>
<option>California  <h4 style="color: grey">Okay2</h4></option>
<option>Delaware  <h4 style="color: grey">Okay3</h4></option>
<option>Tennessee  <h4 style="color: grey">Okay4</h4></option>
<option>Texas  <h4 style="color: grey">Okay5</h4></option>
<option>Washington  <h4 style="color: grey">Okay6</h4></option>
</select>
</div>
