JQuery手风琴单选按钮

JQuery手风琴单选按钮,jquery,html,accordion,jsfiddle,Jquery,Html,Accordion,Jsfiddle,我有两个单选按钮,我想根据用户选择的单选按钮在下面显示一些内容。这是我的密码: 问题: 我似乎找不到正确的p,因此选择单选按钮时不会显示任何内容 知道我的代码为什么不能工作吗?谢谢我对您的HTML代码和JS代码做了简单的修改 <form> <div class="accordion"> <input type="radio" name="recog" id="recog_yes" value="0" /> <l

我有两个单选按钮,我想根据用户选择的单选按钮在下面显示一些内容。这是我的密码:

问题:
我似乎找不到正确的p,因此选择单选按钮时不会显示任何内容


知道我的代码为什么不能工作吗?谢谢

我对您的HTML代码和JS代码做了简单的修改

<form>
    <div class="accordion">  
        <input type="radio" name="recog" id="recog_yes" value="0" />
        <label for="recog">Yes</label>

        <input type="radio" name="recog1" id="recog_no" value="1" />
        <label for="recog">No</label>

        <p>  
            show this for yes
        </p>

        <p>  
            show this for no
        </p>                
    </div>

</form>


Firefox 15中的JSFIDLE(或非JSFIDLE)似乎有一个bug,单选按钮未选中。

谢谢,但我真的很想找出这个小bug。如果选择一个值,它将不会选择另一个值,该值会更改,但另一个值的单选按钮保持为空。检查更新的Js脚本和HTML(请参阅输入单选的名称)。我认为如果使用JSFIDLE,这是Firefox中的一个bug。
$(function(){
    $('.accordion p').hide();

    $('.accordion input[type="radio"]').click(function() {
       $('.accordion p').hide();   

        $('.accordion input[type="radio"]').removeAttr("checked");

        $(this).prop("checked", true);

        if($(this).is(":checked")){
           $("p").eq($(this).val()).show();   
        }

        return false;
    });
});