Javascript jQuery单选子类别在父按钮更改时取消选中

Javascript jQuery单选子类别在父按钮更改时取消选中,javascript,jquery,forms,button,Javascript,Jquery,Forms,Button,我有一个表格可以找到失物招领物品 <input type="radio" name="subcatitemlost" value="subDiv1" />Luggage <div id="subDiv1" class="desc"> <label> <input type="radio" name="subluggage" id="truck" value="t" /> </label>Trunk<

我有一个表格可以找到失物招领物品

<input type="radio" name="subcatitemlost" value="subDiv1" />Luggage
<div id="subDiv1" class="desc">
    <label>
        <input type="radio" name="subluggage" id="truck" value="t" />
    </label>Trunk</br>
    <label>
        <input type="radio" name="subluggage" id="chest" value="chest" />
    </label>Chest</br>
    <label>
        <input type="radio" name="subluggage" id="suitcase" value="suitcase" />
    </label>Suitcase</br>
    <label>
        <input type="radio" name="subluggage" id="duffelbag" value="duffelbag" />
    </label>Duffelbag</br>
    <label>
        <input type="radio" name="subluggage" id="tote" value="tote" />
    </label>Tote</br>
</div>
<br />

<input type="radio" name="subcatitemlost" value="subDiv2" />Clothing
<div id="subDiv2" class="desc">
    <input type="radio" name="subclothing" id="shirt" value="shirt" />
    </label>Shirt</br>
    <input type="radio" name="subclothing" id="shoes" value="shoes" />
    </label>Shoes</br>
    <input type="radio" name="subclothing" id="pants" value="pants" />
    </label>Pants</br>
    <input type="radio" name="subclothing" id="jacket" value="jacket" />
    </label>Jacket</br>
    <input type="radio" name="subclothing" id="suit" value="suit" />
    </label>Suit</br>
    <input type="radio" name="subclothing" id="hat" value="hat" />
    </label>Hat</br>
</div>
<br />
试试这个

$(document).ready(function() {
    $("div.desc").hide();
    $("input[name$='subcatitemlost']").click(function() {
        var test = $(this).val();
        $("div.desc").hide();
        $("#" + test).show();
        $("div input:radio").attr('checked', false);
    });
});

$(document).ready(function() {
    $("div.desc").hide();
    $("input[name$='subcatitemlost']").click(function() {
        var test = $(this).val();
        $("div.desc").hide();
        $("#" + test).show();
        $("div input:radio").attr('checked', false);
    });
});