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
  • 147,524
  • 33
  • 287
  • 271
Duke
  • 199
  • 1
  • 3
  • 10

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
  • 25,525
  • 12
  • 68
  • 75
-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
  • 4,895
  • 2
  • 18
  • 26
-3

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

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