0
<select name="mySelect" class="select-min">
   <option value="0">please select</option>
   <option value="1">item1</option>
   <option value="2">item2</option>
   <option value="3">item3</option>
   <option value="4">item4</option>
   <option value="5">item5</option>
</select>

I want to change the option's height and background color when mouse over the option,I tried many times ,but failed

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
Duke
  • 219
  • 1
  • 4
  • 11

3 Answers3

5

<select> or <option> HTML tag are rendering itself the time of webpage load. So You can not change the style for these elements.

Jaykumar Patel
  • 26,836
  • 12
  • 74
  • 76
-1
Please try this :-

 $(document).ready(function () {
    $(".select-min option").mouseover(function () {
      $(this).css({ "background-color": "black", "color": "white", "height": "32"});
    });

    $(".select-min option").mouseout(function () {
      $(this).css({ "background-color": "white", "color": "black", "height": "5" });
    });
 });

Let me know if it doesn't work.
Naveen Chandra Tiwari
  • 5,055
  • 3
  • 20
  • 26
-3

For the Height, i don't think it's possible. For the hover:

select:hover { background-color: blue; }
Mazeltov
  • 541
  • 5
  • 18