1

Im getting the error on the console

var modal = document.getElementById('simpleModal');
var modalBtn = document.getElementById('modalBtn');
var closeBtn = document.getElementById('closeBtn');

modalBtn.addEventListener('click', openModal);

function openModal() {
  console.log(123);
}
<button id="modalBtn" class="button">Click Here</button>

<div id="simpleModal" class="modal">
  <div class="modal-content">
    <span class="closeBtn">&times;</span>
    <p> hello I am a modal>
  </div>
</div>

What I am doing is trying to make a modal open but Im keep on failing.

PotatoParser
  • 738
  • 4
  • 17
mimi
  • 21
  • 4
  • Make sure your script comes after your elements – PotatoParser Aug 21 '20 at 21:02
  • @Taplar OMG so I was supposed to put the on the very bottom of the body section. I didn't knew that also gets read in order from top to bottom! Thank You – mimi Aug 21 '20 at 21:06

0 Answers0