如何选择名为id =“Paragraph1”的段落中的每个子复选框,并取消选中它,如果它的选中,然后禁用它在jQuery中。jQuery为每个孩子复选框在一个段落编号
实施例:
<input type="checkbox" id="chkMain"><br />
<p id="Paragraph1">
<input type="checkbox" id"chk1"><br />
<input type="checkbox" id"chk2"><br />
<input type="checkbox" id"chk3"><br />
<input type="checkbox" id"chk4"><br />
</p>
jQuery的选择:
$("#chkMain:not(:checked)").change(function() {
$("#Paragraph1").children("input[type='checkbox' :checked]").each(function() {
$(this).removeAttr("checked").attr("disabled",disabled");
});
});
该代码是不正确的工作二/三其仅工作一半的时间由于某种原因在IE8。也使用查找不工作的权利或者B/C段落不是一个好父母。
这是否工作jQuery的1.7.2.js?无法得到这个工作。另外我没有看到.prop作为一个实际功能。 – RetroCoder 2013-02-18 21:19:13
@RetroCoder,是的,它的作品。至于'道具',你的坏... – gdoron 2013-02-19 08:42:22