<div>Group 1
<br>
<label>
<input type="checkbox" name="testing" value="B" checked="checked">A</label>
<br />
<label>
<input type="checkbox" name="testing" value="I">B</label>
<br />
<label>
<input type="checkbox" name="testing" value="A">C</label>
<br />
</div>
<div>Group 2
<br>
<label>
<input type="checkbox" name="testing2" value="B">A</label>
<br />
<label>
<input type="checkbox" name="testing2" value="I">B</label>
<br />
<label>
<input type="checkbox" name="testing2" value="A">C</label>
<br />
</div>
JS
$("input:checkbox").change(function() {
var checkname = $(this).attr("name");
if (this.checked) {
$("input:checkbox[name='" + checkname + "']").removeAttr("checked").parent().hide();
this.checked = true;
$(this).parent().show();
} else {
$("input:checkbox[name='" + checkname + "']").parent().show();
}
});
當複選框被完美地檢查工程隱藏/顯示腳本,但如果一個複選框是在窗口負載initialy檢查,如何使其運行上面的腳本是否會隱藏其他未檢查的腳本?
http://jsfiddle.net/warface/uvYzW/
超級大騙子! – Warface 2013-04-03 19:25:54