Select2 is not adding the classes to its dropdown items from the options
Suppose in the below dropdown code, attribute class="highlight" was added to few options to highlight those with some background color. But select2 is not adding this class="highlight" to list items in dropdown
See the difference in below images.
Normal dropdown (cities1)
Select2 dropdown (cities2)
is it possible to get the same class names from options to select2 dropdown items?
Please help
$('#cities2').select2();
.highlight {
background-color: #FFCCCB;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.full.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet"/>
<select id="cities1">
<option value="1">New York</option>
<option value="2">Los Angeles</option>
<option value="3" class="highlight" >San Diego</option>
<option value="4">Miami</option>
<option value="5" class="highlight">Cambridge</option>
</select>
<select id="cities2">
<option value="1">New York</option>
<option value="2">Los Angeles</option>
<option value="3" class="highlight" >San Diego</option>
<option value="4">Miami</option>
<option value="5" class="highlight">Cambridge</option>
</select>

