[jQuery] selectbox event problem in MSIE
Hello!
When I try to bind an event to an option of a selectbox item, this
works with Firefox and Opera, but not in MS Internet Explorer 7.
Example of the code:
<script type = "text/javascript">
$(document).ready(function() {
$("#wgt2 option").click(function() {
var selectText = $(this).text();
var selectValue = $(this).val();
alert("Test: " + selectText);
});
});
</script>
[...}
<form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post"
accept-charset="utf-8">
<select style="width: 100px; " name="wgt2" id="wgt2" multiple
size="5">
<option value="1option1">option1</option>
[...]
<option value="8option1">option8</option>
</select>
A demo and the complete code you'll find here:
http://geschke.name/jqtest/
I tried multiple event types (change, mouseup, click) with their own
methods and by using the bind() method, but it didn't work. Is this a
well-known MSIE problem?
If I bind the change event to the select element only, so in above
code without the " option" path, it works. But then I have to find out
the selected item afterwards.
Any help is appreciated!
Thanks in advance & Kind regards,
Ralf