Changing Font Color Of Selected Item By User With Select2
I've simple select option html:
Solution 1:
I can think some of the solutions using JS though not sure if there's an easier way for that using the select2 plugin.
Easier way I can think of is to create a placeholder instead of having a default option.
From:
$(document).ready(function(){
$(".select2").select2();
});
To:
$(document).ready(function(){
$("#individual_taxCountry").select2({
placeholder: "Select a state*"
});
});
Then on your html, set an empty option value where the placeholder will take place.
Replacing this:
<option value="" selected="selected"class="selected">Select a country*</option>
To this:
<option></option>
Then add those necessary css for the font color
.select2-container--default.select2-selection--single.select2-selection__placeholder {
color: #444;
}
.select2-container--default.select2-selection--single.select2-selection__rendered {
color: #fff;
}
Solution 2:
Just add this css to your css code
.select2-container--default .select2-selection--single .select2-selection__rendered{
color: #fff
}
https://jsfiddle.net/bhuffprL/
Post a Comment for "Changing Font Color Of Selected Item By User With Select2"