3 minutes to write out the Jquery version of the checkbox full selection anti selection function

  • 2020-03-26 21:31:55
  • OfStack

 
// The selected  
function selectnoALL() { 
$("input:checkbox").each(function (i) { 
if (this.checked) { 
this.checked = false; 
} else { 
this.checked = true; 
} 
}); 
} 
// Future generations  
function selectALL() { 
var chelength = $("input:checkbox").length; 
$("input:checkbox").each(function (i) { 
if (i < chelength - 2) { 
this.checked = true; 
} 
}); 
} 

3 minutes to write out a lot of bugs

Related articles: