I am using select2 to populate an HTML select, I want select2 options to have same background color as html select control options, is there any option in select2JS that allow us to do it or I have to do it manually?
Here is the sample code
$('.selectcls').select2({
minimumResultsForSearch: -1,
placeholder: "Nothing selected",
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.js"></script>
<div>
<select id="select1" class="selectcls" style="width:100px" name="select1this" class="wrap">
<option></option>
<option style="background-color:green" value="A21">A21</option>
<option style="background-color:blue" selected value="A22">A22</option>
<option style="background-color:orange" value="A23">A23</option>
</select>
</div>
or