1

I have a simple select tag

   <select>
        <option value="a">a</option>
        <option value="b">b</option>
        <option value="c">c</option>
        <option value="d">d</option>
    </select>

I want add hover event on option

   $('select option').hover(function(){
        console.log($(this).val());
    },function(){
        console.log("mouse out");
    });

However, it only works in Firefox, not in Chrome. How can I solve this problem? Is it a bug in jquery? Is there some hack?

4

1 回答 1

2

对于 Chrome 和 IE 中的选项元素,悬停事件不会触发,其他浏览器也可能如此。您可以尝试为此使用一些自定义脚本:http: //peterned.home.xs4all.nl/csshover.html

于 2012-04-20T04:19:25.277 回答