我有一個簡單的表格:jQuery的事件()
<div class="class_a">
<fieldset>
<label><input type="radio" id="radio10" name="color" value="1" />Red</label><br />
<label><input type="radio" name="color" value="2" />Yellow</label><br />
<label><input type="radio" name="color" value="3" />Blue</label><br />
<label><input type="radio" name="color" value="4" />Purple</label><br />
</fieldset>
</div>
<div class="block-cms">
<fieldset>
<label><input type="radio" name="time" value="6" />12</label><br />
<label><input type="radio" name="time" value="7" />11</label><br />
<label><input type="radio" name="time" value="8" />10</label><br />
<label><input type="radio" name="time" value="9" />9</label><br />
</fieldset>
</div>
什麼即時試圖在這裏做的是通過使用jQuery的變化()隱藏掉第二個字段集。
$("input#radio10").change(function() {
var checked = true;
checked = checked && $(this).is(':checked');
if ($('input#radio10:checked')) {
$('.block-cms').show()
}
else {
$('.block-cms').hide();
}
});
不確定這裏有什麼問題。任何人都可以建議我應該做什麼不同請嗎?
對不起,那是簡單的拼寫錯誤。但仍然不起作用。 – Dom 2010-11-10 10:10:32
@Dom - 檢查演示,是不是你在之後,只顯示紅色被選中? – 2010-11-10 10:11:45
謝謝! – Dom 2010-11-10 10:13:31