html - select option:checked background color change but option text color not change in css -


select option:checked background color perfect work option text color not work please me

css code

<style>         select option:checked{             background: red linear-gradient(0deg, red 0%, red 100%);             color: #000 ! important;         }    </style> 

html code

<select multiple>   <option value="1">one</option>   <option value="2">two</option>   <option value="3">three</option> </select> 

please ans me thank you

here solution

<select multiple class="select_option_class_name">   <option value="1">one</option>   <option value="2">two</option>   <option value="3">three</option> </select>    $('.select_option_class_name').change(function () {     $(this).find('option:selected').css('color', 'red');    $(this).find('option:selected').css('background-color', 'red'); }).trigger('change'); 

i think want

<style>     .select_option_class_name{         color:red;         background-color:red;      }  </style> 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -