Reputation: 3938
I am tryinh to get the value of my selected list box when I hover over it. The below code works well in google crome but does not work in internet explorer. Is there a way to get this working in IE.
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#ListBox1 option").hover(
function (e) {
var a = this.value;
alert(a);
});
});
</script>
<select name="drop1" id="ListBox1" size="4" multiple="multiple">
<option value="1">item 1</option>
<option value="2">item 2</option>
<option value="3">item 3</option>
<option value="4">item 4</option>
<option value="0">All</option>
</select>
Upvotes: 1
Views: 1121
Reputation: 39872
Use :selected to alert when over the selected item
$("#ListBox1 option:selected").hover( function () { alert(); });
Upvotes: 0
Reputation: 24236
You could try using the jQuery wrapper on the select list, that might remove the browser specific problems -
$(document).ready(function () {
$("#ListBox1 option").hover(
function (e) {
var a = $(this).val();
alert(a);
});
});
Upvotes: 3