在复选框树中获取子状态复选框

时间:2016-11-07 14:10:44

标签: javascript html css

我在树状结构中有复选框。 enter image description here

问题:当我点击超级复选框时,我想要所有子复选框的状态(子复选框)。使用此状态我可以启用/禁用除这些子复选框之外的相应按钮。

出于某些安全原因,我无法发布脚本但可以共享HTML

CODE:

.section{flow:horizontal;margin-left:25px;}
.leftText{width:100px;}
<div class="superWrapper">
	<div class="super" id="CheckbBox1">
		<input type="checkbox"  class="testCheck" name="Checkbox" id="Checkbox01" value=true checked />
		<label for="Checkbox01">Super1</label>
	</div>
	<div class="wrapper" id="wrapper1">
		<div class="section" id="subtext1" >
			<div class="leftText" id="check1" >
				<input type="checkbox" name="name1" id="Checkbox01_1" />
				<label for="Checkbox01_1"><span>Sub 1</span></label>
			</div>
			<div class="rightBtn">
				<button class="BtnNrm">Button 1</button>
			</div>
		</div>
		
		<div class="section" id="subtext2" >
			<div class="leftText" id="check2" >
				<input type="checkbox" name="name2" id="Checkbox01_2" />
				<label for="Checkbox01_2"><span>Sub 2</span></label>
			</div>
			<div class="rightBtn">
				<button class="BtnNrm">Button 2</button>
			</div>
		</div>
		<div class="section" id="subtext3" >
			<div class="leftText" id="check3" >
				<input type="checkbox" name="name3" id="Checkbox01_3" />
				<label for="Checkbox01_3"><span>Sub 3</span></label>
			</div>
			<div class="rightBtn">
				<button class="BtnNrm" >Button 3</button>
			</div>
		</div>
	</div>
	<!-- Check box 2 -->
	<div class="super" id="CheckbBox2" >
		<input type="checkbox"  class="testCheck" name="Checkbox" id="Checkbox02" value=true checked />
		<label for="Checkbox02">Super2</label>
	</div>
	<div class="wrapper" id="wrapper2">
		<div class="section" id="subtext4" >
			<div class="leftText" id="check4" >
				<input type="checkbox" name="name4" id="Checkbox02_1" />
				<label for="Checkbox02_1"><span>Sub 4</span></label>
			</div>
			<div class="rightBtn">
				<button class="BtnNrm">Button 1</button>
			</div>
		</div>
		
		<div  class="section" id="subtext5" >
			<div class="leftText" id="check5" >
				<input type="checkbox" name="name5" id="Checkbox02_2" />
				<label for="Checkbox02_2"><span>Sub 5</span></label>
			</div>
			<div class="rightBtn">
				<button class="BtnNrm">Button 2</button>
			</div>
		</div>
	</div>
</div>

任何帮助?

0 个答案:

没有答案