Problem with CSS class on SELECT

Problem with CSS class on SELECT

Here is a sample code to explain the problem:
  1. CSS part:
  2. option.sel { color:red }

  3. HTML part:
  4. <select id="test">
  5. <option value="1" selected>1</option>
  6. <option value="2">2</option>
  7. <option value="3">3</option>
  8. </select>

  9. jQuery part:
  10. $("#test option:selected").addClass("sel")


When testing this sample code on several browsers, I get different results:

  • On IE8 the selected option is red on the current selected box, but is still black into the popup list
  • On FF or Chrome the selected option is still black on the current selected box, but is red into the popup list
All seems to be wrong, this option should be red everywhere it appears.