Reputation: 2637
I want to catch an event whenever a user hovers over a list element.
The following code below works fine with Mozilla and Chrome but not in IE8. How can I get it to work in IE8?
Here's the 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>
Upvotes: 0
Views: 851
Reputation: 68596
It appears that in Internet Explorer (even in recent versions such as IE9/IE10 sadly), Hover
/Mouseover
events will not fire when the object in question is an <option>
.
See the list of available <option>
events for the IE browsers here.
Upvotes: 3
Reputation: 856
what if you use:
$('#thelist').hover(function(e){
alert(e.pageX + ' ' + e.pageY);
});
Upvotes: 0