-1

I have a select dropdown and certain number of options in that.

I want to change color of options whenever i hover in and out of the option.

Like :- when i hover on a option the color should turn to red and when i hover out i should be transparent again.

it is not working proper.

JS

$("select").hover(function (e){
    var $target = $(e.target); 
    if($target.is('option')){
        $target.css('background-color', 'red');
    }
});

HTML

<select class="select1" size="8" >
 <option>Ajwa Finance Ltd. </option>
 <option>Ajwa Fun World & Resort Ltd. </option>
 <option>Akar Tools Ltd.</option>
 <option>Akasaka Electronics Ltd.</option>
 <option>Akash Agencies Ltd.</option>
 <option>Akash Agro Inds. Ltd.</option>
</select>

Please help me with this

Thanks

user1999887
  • 1
  • 1
  • 4
  • posting some code code as well would help others to pick it up quickly! – Rohit416 Jan 22 '13 at 10:17
  • possible duplicate of [Change Select List Option background colour on hover](http://stackoverflow.com/questions/10484053/change-select-list-option-background-colour-on-hover) – doppelgreener May 01 '15 at 07:25

1 Answers1

-1

The below question's answer will guide you to achieve that .

all the best :)

Html Select box options on Hover?

Community
  • 1
  • 1
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307