jquery1.4.1获取选中radio的值,在firefox3.5下不行?

代码:

<html>
    <head>
        <script type="text/javascript" src="jquery-1.4.1.min.js"></script>
        <script>
            function show() {
                alert($("input[type=radio][checked]").val());
            }
        </script>
    </head>
    <body>
        <input name="test" type="radio"  value="1">
        <input name="test" type="radio"  value="2">
        <input name="test" type="radio"  value="3">

        <input type="button" value="显示选中radio的值" onclick="show()">
    </body>
</html>

 操作步骤:

1.选中其中一个radio框

2.点击按钮

 

疑问:按上述步骤操作后,

$("input[type=radio][checked]").val() 

 这段代码在IE6.0,firefox2.0下有效,但在我本地的firefox3.5.7下显示为undefined,是jquery1.4.1对firefox3.5.7支持不够好吗?或者jquery有其他的方式来获取radio的值?

[code="java"]alert($(":radio:checked").val()); [/code]

你可以用$(":radio:checked").val()试试

<br> function show() {<br> $(&#39;input:radio&#39;).each(function(){<br> if ($(this).attr(&#39;checked&#39;)){<br> alert($(this).val());<br> }<br> });<br> }<br>