0
I need to create a checkbox if it is selected it will select all others and if it is not selected others must also be deselected.
I tried to do something but it didn’t 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 checkbox inputs are generated dynamically.
'<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>'
The code did not select all, actually selected none
– Renan Rodrigues
@Renanrodrigues see here the code working http://jsfiddle.net/msyjs7ch/
– Erick Gallani
It did work yes kkkk, because it had bugged. Thanks more.
– Renan Rodrigues
Friend I need to add a question, when I mark I need the text to uncheck all, and when I don’t have to mark all, as I take the event marked to ?
– Renan Rodrigues
What is the HTML structure of your checkbox to check and uncheck, I mean where is it going to be written check and uncheck? I’ll edit the answer with an example.
– Erick Gallani
<div id="nameSelectAll"></div>
– Renan Rodrigues
You are 10, thank you very much
– Renan Rodrigues