HTML Warunkowy wyświetlacz
<body>
<div id="display">This div will stay visible</div>
<div id="conditional">This div will appear if conditional is true</div>
<button onclick="toggle_display()">Toggle conditional display</button>
<script>
const conditional_div = document.getElementById('conditional');
let condition = true;
const toggle_display = function() {
if (condition) {
conditional_div.style.display = "none";
condition = false;
return
};
//can be: flex, grid, etc...
conditional_div.style.display = "block";
condition = true;
return
};
</script>
</body>
Julio Polycarpo