I need to create a checkbox if it is selected it will select all the others and if it is not selected the others should also be deselected.
I tried to do something but it did not work. See:
$("#selectAll").on('checked', function () {
$(".checkReunioes").each(function( index ) {
$( this ).attr("check", "checked");
});
});
Select All :
<li class="item item-checkbox colorCheck">
<label class="checkbox checkbox-dark">
<input type="checkbox" id="selectAll">
</label>
<div id="nameSelectAll"></div>
</li>
Remaining of the checkbox inputs are dynamically generated .
'<li class="item item-checkbox">'+
' <label class="checkbox">'+
' <input type="checkbox" class="checkReunioes">'+
' </label>'+
' <div data-uib="layout/card" data-ver="0">'+
((reunioes[i].COD_PESSO_LOCAL == "999") ? '<div class="">'+ reunioes[i].TXT_DESCR_ENDER +'</div>' : '<div class="">Casa '+ ((w_elemento == "M") ? "do " : "da ")+''+ reunioes[i].TXT_LOCAL_REUNI +' </div>')+
' <div class="card_Data">'+DataInvertida+'</div>'+
' <input id="codigoReuniao" value="'+reunioes[i].COD_IDENT_REUNI+'" hidden/>'+
' </div>'+
'</li>'