用jquery取radio值出错,求指点?

浏览:708 发布日期:2013/11/22 分类:求助交流
下列代码中,我无论选择B还是C,返回的结果都是A。
代码如下:<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
</head> 
<body>
<input type='radio' name='part' value='A' checked/>A<br/>
<input type='radio' name='part' value='B' />B<br/>
<input type='radio' name='part' value='C' />C<br/>
<script type="text/javascript"> 
    $(document).ready(function () {
        $("input[name='part']").click(function(){
            $unitValue=$("input[name='part'][checked]").val();
            alert($unitValue);
        });
    });
</script>
</body>
</html>
最佳答案
评论( 相关
后面还有条评论,点击查看>>