标签:else click ready cti checkbox this checked att read
$(document).ready(function() {
 $("#isalldebt").click(function()
	 				{
			 			 if ($(this).attr("checked")) { // 全选 
			
			 				 $("input[name=‘debt_type‘]").each(function(){ 
			 		 		      $(this).attr("checked", true);   
			 		 		    }); 
			             }
			             else { // 取消全选 
			
			            	 $("input[name=‘debt_type‘]").each(function(){ 
			   	 		      $(this).attr("checked", false);   
			   	 		    }); 
			             }
	 				});
	 		
			
		});
=======================下面html代码
<input id="1" name="debt_type" value="0" type="checkbox">
<input id="2" name="debt_type" value="1" type="checkbox">
<input id="3" name="debt_type" value="2" type="checkbox">
 <input type="checkbox" id="isalldebt"> 
				<label for="isalldebt" onclick="isalldebt()" >全选</label>
	 		
标签:else click ready cti checkbox this checked att read
原文地址:http://www.cnblogs.com/yangjinwang/p/6017147.html