JSFiddle - React, Tailwind, and code Playground
by werty1001
HTML
<div id="somediv" style="display:none;">1111</div>
<div id="somediv2" style="display:none;">2222</div>
<input type="checkbox" data-show="somediv">
<input type="checkbox" data-show="somediv2">
JavaScript
(function(){
var checkboxs = document.querySelectorAll('input[data-show]');
for (var i=checkboxs.length; i--;) {
checkboxs[i].addEventListener('change', function() {
document.getElementById(this.dataset.show).style.display = (this.checked ? 'block' : 'none');
});
}
})();