Combining multiple elements with .addEventListener

  1. sideBar is an id not a class document.querySelector('#sideBar')

  2. You also misspelled class="feeter"

Edit: I just noticed that the code chokes on the first code block if you do not end it with a semicolon ;

document.querySelector('.openbtn').addEventListener('click', () => {
  document.getElementById('sideBar').style.display = 'block';
  document.getElementById('openbtn').style.display = 'none';
});
1 Like