Problem finding selected radio button in Internet Explorer with function/onchange - wrong value obtained

Problem finding selected radio button in Internet Explorer with function/onchange - wrong value obtained

Hi all,

The following code works fine in FF and Chrome for getting a radio selections value but not IE8.

$('input[name="search[gender]"]').change(function()
    {
        var check = $('input[name="search[gender]"]:checked').val();

Inputs are below:

<input type="radio" name="search[gender]" value="1" class="v_middle" />Male
<input type="radio" name="search[gender]" value="2" class="v_middle" />Female
<input type="radio" name="search[gender]" value="3" class="v_middle" />Couple
<input type="radio" name="search[gender]" value="4" class="v_middle" />tv
<input type="radio" name="search[gender]" value="" checked="checked" class="v_middle" />All

The first time you click a radio button in IE8, no value is returned at all (tested with document.write of the 'check' value), with an error "'null' is null or not an object". The second (and rest of the times) you click any of the checkboxes the wrong value is returned, it returns the value of the currently checked button (which we checked a moment ago) rather than the one we have checked the second time.

Does Internet Explorer have issues with this onchange function method? Or is something wrong with my code?

Any and all help much appreciated.