checkbox一鍵全選/取消

直接上代碼

$(document).ready(function () {
    $('#orChecked').change(function(){
		if($(this).is(':checked')){
			$('#box').find(':checkbox').prop('checked',true);
		}else{
            $('#box').find(':checkbox').prop('checked',false);   
		}
        //數據處理
        addCodeAll($(this).is(':checked'));
	})
 });

<table id="contentTable"
	class="table table-striped table-vmiddle bootgrid-table">
	<thead>
	    <tr>
			<th class="col-xs-1">
				<label class="checkbox checkbox-inline m-r-20" title="全選/取消全選">
					<input type="checkbox" id="orChecked" />
				    <i class="input-helper"></i>
                </label>
                序號
            </th>
	    </tr>

	</thead>
	<tbody id="box">
	    <c:forEach items="${pageList }" var="item" varStatus="status">
			<tr>
				<td >
                    <label class="checkbox checkbox-inline m-r-20">
						<input type="checkbox"/>
						<i class="input-helper"></i>
                    </label>
					${(page.pageNo-1)*page.pageSize + status.count }
				</td>
			</tr>
		</c:forEach>
	</tbody>
</table>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章