hello this is the code I have been learning but the javascript doesn't work
<script>
const toggleBtn = document.querySelector('.button');
const menu = document.querySelector('.settings');
toggleBtn.addEventListener('click', () => {menu.classList.toggle('active');})
</script>
<body>
<a href="#">
<div class="button">button show</div>
</a>
<div class="settings"> hello world</div>
</body>
please help. The console says that
toggleBtn.addEventListener('click', () => {
menu.classList.toggle('active');
})
is not working.
I just to make the text appear when the button is clicked. I've copied the same code from a text but not working for me.
I am new to javascript. It will be very thankful if you help me.