选择器过滤不需要的组件,例如class,实现div disabled
div本身没有disabled 和 readonly属性
可以通过对其内部组件的属性改变,来实现对整体div的操作
主要代码:
// [选择器]:not([跳过的组件属性])
function change() {
$("displayTableDiv").find("td:not(.skippedTd)");
}
// 从父级筛选就用两层find
$("displayTableDiv").find("td:not(.skippedTd)").find("input[type=checkbox]").prop("disabled", false);
举例:
<div id="displayTableDiv">
<table>
<tr>
<td class="skippedTd">
<input type="checkbox" value="0"/>
</td>
<td class="skippedTd">
<select id="selectTime"></select>
</td>
</tr>
<tr>
<td>
<input type="checkbox" value="1"/>
</td>
<td>
<select id="selectDay"></select>
</td>
</tr>
</table>
</div>
function change() {
$("displayTableDiv").find("td:not(.skippedTd)").find("input[type=checkbox]").prop("disabled", false);
$("displayTableDiv").find("td:not(.skippedTd)").find("select").prop("disabled", false);
}