0

Is there any way to set the text colour of a selected option in mozilla?

https://jsfiddle.net/36sk6wd0/9/

<option selected>blue?</option>

You can change the background using a linear gradient, but is there some hack to change the colour as well?

Artemis
  • 2,553
  • 7
  • 21
  • 36
  • Possible duplicate of [Why we can't style option of dropdown using CSS?](https://stackoverflow.com/questions/43406185/why-we-cant-style-option-of-dropdown-using-css) – Sebastian Simon Feb 28 '18 at 12:54

1 Answers1

0

use this link. i hope it's very helpful to you

$(document).ready(function() {
  $(document).on("click", "#changeColor", function() {
    $("option").removeClass("change_color");
    $("#changeColor :selected").addClass("change_color")
  })
})
.change_color{
  color:green;
  background-color:yellow;
  
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<select id="changeColor">
  <option>red</option>
  <option>red</option>
  <option>red</option>
</select>
Ashfaqur_Rahman
  • 140
  • 1
  • 9
Waqas Ali
  • 116
  • 8