在Firefox中而不是Safari中读取单选按钮值时出现jQuery错误

在Firefox中而不是Safari中读取单选按钮值时出现jQuery错误,jquery,firefox,radio,Jquery,Firefox,Radio,我在Firefox/Firebug中发现以下错误,但在Safari中没有 $input[name='how_many']:checked.val不是函数 代码如下: $(document).ready(function(){ $("#message-form").change(function(){ var selectedRadio = $("input[name='how_many']:checked").val(); if(selectedRad

我在Firefox/Firebug中发现以下错误,但在Safari中没有

$input[name='how_many']:checked.val不是函数

代码如下:

$(document).ready(function(){
    $("#message-form").change(function(){

        var selectedRadio = $("input[name='how_many']:checked").val();

        if(selectedRadio == "some")
        {
              $("#conditional").fadeIn("slow");
        }else{
              $("#conditional").fadeOut("slow");
        };        
    });
});

不知道为什么会这样做,但我将我的脚本移到了前面的底部,现在它可以在Firefox、Chrome和Safari中工作。

是默认选中的输入之一吗?如果没有,jQuery找不到它,因此它没有值。是的,有两个单选按钮,其中一个被选中。消息表单id是什么?我想你有一个选择框,然后下面有一个收音机框X??请您将代码粘贴到jsfiddle.net上,以便我们能更好地回答您的问题。message form是这两个单选按钮所在窗体的id。单选按钮组名为“多少”。