Jquery js operation checkbox all selected anti selected

  • 2020-03-30 02:19:51
  • OfStack

Operate the checkbox and select all unselected
 
// Future generations  
function checkAll() { 
$('input[name="TheID"]').attr("checked", "checked"); 
} 
// The selected  
function uncheckAll() { 
$('input[name="TheID"]').each(function() { 
this.checked = !this.checked; 
}) 
} 
//Gets the selected item
function getCheck(){ 
var check = $('input[name="TheID"]:checkbox').map(function() { 
return $(this).val(); 
}).get().join(','); 
return check; 
} 

Related articles: