tr checkbox 冒泡 全选动态变化

<tr>
	<td>
	<input type='checkbox' onclick="select_all()"  name='export-checkbox'>
	</td>
	<td class="name exclude">
		
	</td> 
	<td class="exclude">
	</td> 
	<td class="exclude" >

    </td>


	<td class="action exclude">
	</td>
</tr>
//实现全选功能 
$("#checkAll").click(function(){
    $('[name=export-checkbox]:checkbox').prop('checked',this.checked);//checked为true时为默认显示的状态
});
function select_all() {

	var checkbox_length = $("input[name='export-checkbox']").length;//checkbox总数量
	var export_checkbox_length = $("input[name='export-checkbox']:checked").length;
	if(checkbox_length==export_checkbox_length){
		$('#checkAll').prop("checked", true); 
	}else{
		$('#checkAll').prop("checked", false); 
	}
}
	//之前是点击tr 现在改为点击class
	$('#main tbody').on("click", ".exclude", function(event) {
	});

猜你喜欢

转载自blog.csdn.net/damei2017/article/details/82879051
tr