欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

复选框全选控制

程序员文章站 2024-02-05 13:47:58
...

复选框全选控制

<script type="text/plain" id="schClearTemplaet">
		<div class="form-group" id = "clearZT">
			<div class="form-check form-check-inline">
                <input class="form-check-input" type="checkbox" name="ZT" value="1" id="schClear1">
                <label class="form-check-label" for="schClear1">清空导入数据</label>          
			</div>
			<div class="form-check form-check-inline">
                <input class="form-check-input" type="checkbox" name="ZT" value="2" id="schClear2">
                <label class="form-check-label" for="schClear2">清空分析结果</label>          
			</div>
		</div>
		<hr>
		<div class="form-group" id="schClearSubject">
			<div class="form-check mb-2">
                <input class="form-check-input" type="checkbox" id="schAllClear" style="top: -5px;">
                <label class="form-check-label" for="schAllClear">全选</label>          
			</div>
            {{each examinationStatus item}}
            <div class="form-check mb-1">
                <input class="form-check-input" type="checkbox" name="subjects" id="subjectChickbox{{item.paper.paperCode}}" value="{{item.paper.paperCode}}" style="top: -5px;">
                <label class="form-check-label" for="subjectChickbox{{item.paper.paperCode}}">{{item.paper.subject.name}}</label>
				<p class="float-right">{{item.paper.paperName}}</p>            
			</div>
            {{/each}}
        </div>
    </script>
$('#schAllClear').on('click',function(){
            if(this.checked) {
                $("#schClearSubject input[name='subjects']").prop('checked',true);
            }else {
                $("#schClearSubject input[name='subjects']").prop('checked',false);
            }
        });

 

 

相关标签: CheckBox 复选框