每当用户将鼠标悬停在列表元素上时,我想捕捉一个事件。
以下代码适用于 Mozilla 和 Chrome,但不适用于 IE8。我怎样才能让它在 IE8 中工作?
这是 jsFiddle - http://jsfiddle.net/tromanow/U9wAz/
jQuery:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#thelist option').hover(function(e){
alert('here');
});
});
</script>
HTML:
<select id="thelist" name="sometext" size="4" >
<option data-info="this is text1">text1</option>
<option data-info="this is text2">text2</option>
<option data-info="this is text3">text3</option>
<option data-info="this is text4">text4</option>
<option data-info="this is text5">text5</option>
<option data-info="this is text5">text6</option>
<option data-info="this is text5">text7</option>
</select>