你可以这样做:http: //jsfiddle.net/kayen/fGrT2/
HTML:
<div id="petTest">
<fieldset>
<legend>Do you have a pet?</legend>
<ul>
<li><label for=""><input type="radio" name="petstatus" value="Yes" /> Yes</label></li>
<li><label for=""><input type="radio" name="petstatus" value="No" /> No</label></li>
</ul>
</fieldset>
<fieldset>
<legend>Is it big?</legend>
<ul>
<li><label for=""><input type="radio" name="petsize" value="Yes" /> Yes</label></li>
<li><label for=""><input type="radio" name="petsize" value="No" /> No</label></li>
</ul>
</fieldset>
<fieldset>
<legend>Is it a dog?</legend>
<ul>
<li><label for=""><input type="radio" name="pettype" value="Yes" /> Yes</label></li>
<li><label for=""><input type="radio" name="pettype" value="No" /> No</label></li>
</ul>
</fieldset>
<fieldset>
<legend>Please note that dogs are not allowed at this event!</legend>
</fieldset>
</div>
查询:
$("#petTest fieldset")
.hide()
.eq(0).show()
.end()
.find("input[value='Yes']")
.click(function() {
$(this).parents("fieldset").next().show(300);
})
.end()
.find("input[value='No']")
.click(function() {
$(this).parents("fieldset").nextAll().hide(300, function(){
$(this).find("input").attr("checked", false);
});
});