I've been googling for about 2 hours to fix the following problem (other Stackoverflow Questions included):
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('input[type="radio"]').unbind('click.preset')
.bind('click.preset', function() {
doingStuffWith(jQuery(this).val());
});
});
</script>
<input type="radio" name="lightType" value="led" />
<input type="radio" name="lightType" value="tube" />
As you can see, I'm just trying to retrieve the current value of the radio button group "lightType" to work with it. This is working like a charm in Firefox / Safari / Chrome, but IE8 is giving me a hard time by just returning an empty string.
I've already tried several hacks from other questions like binding the change event to the radio buttons und forcing IE8 to fire it by blurring the clicked radio button etc. Maybe I'm just suffering from blindness right now.
I'm working with the latest jQuery version and I've made sure that no other binded events interfere. Interestingly though, adding an alert() before retrieving the value and IE returns the current value:
....
// DOES WORK
alert();
alert(jQuery(this).val()); // alerts e.g. "tube"
// DOESN'T WORK
alert(jQuery(this).val()); // alerts ""
I thought it could be a timing problem, but trying to delay my single alert call with setTimeout didn't help.
Thanks in advance guys, I hope I'm just blind and didn't find another ugly behaviour in IE8.