const targetDiv = document.getElementById("weging");
const btn = document.getElementById("toggle");
btn.onclick = function() {
if (targetDiv.style.display !== "none") {
targetDiv.style.display = "none";
} else {
targetDiv.style.display = "block";
}
}
#cijfers {
display: none;
}
<div id="weging">
<p>Hello</p>
</div>
<button type="button" id="toggle">Volgende</button>
<div id="cijfers">
<p>Hello2</p>
</div>
Hello guys, I have this litte part in my website. When I press the button I want to hide div 'weging' and show div 'cijfers'. The div 'weging' hides perfectly with this JS code, but how can I show the div 'cijfers'. If anyone can help me out I would appreciate it a lot!