User:Phantomxz/Sandbox: Difference between revisions

From Ylvapedia
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
     <span id="textToHide" style="margin-top: 5px;">This is the text to hide.</span>
     <span id="textToHide" style="margin-top: 5px;">This is the text to hide.</span>
</div>
</div>
<script>
document.getElementById('hideCheckbox').addEventListener('change', function() {
    var textToHide = document.getElementById('textToHide');
    textToHide.style.display = this.checked ? 'none' : '';
});
</script>

Revision as of 18:31, 1 June 2024

   <input type="checkbox" id="hideCheckbox" style="display: none;">
   <label for="hideCheckbox" style="cursor: pointer;">Hide Text</label>
   This is the text to hide.