JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<div id="container">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
</div>
<button type="button" id="addAll">add all</button>
<button type="button" id="removeAll">remove all</button>
JavaScript
$("#addAll").click(function() {
// $("#container input").attr('checked','hh');
$("#container input").toArray().forEach(function(value){
value.setAttribute('checked','true')
});
console.log( $("#container input").prop('checked'));
});
$("#removeAll").click(function() {
//$("#container input").removeAttr('checked');
$("#container input").toArray().forEach(function(value){
value.removeAttribute('checked')
});});