this is where i test my code before putting it in the actual pages lol

...

removeDiv = document.getElementById('extra'); // document.querySelector('#extra') button.addEventListener('click', () => { //* to avoid error, you can check with condition statement OR try..catch if (removeDiv) { removeDiv.remove(); } });