0

So, I am building a site with an alert, so basically what happens is when you get on, after 10s a div alert shows, alerting the user. My Javascript should be correct but I do not know where I have gone wrong. Can someone please help me?

const scripter = document.getElementsByClassName('alertor')
setInterval(showElement, 200)

function showElement() {
  scripter.style.display = 'block';
}
.alertor {
  width: 100%;
  height: 125px;
  background: #f086ec;
  display: none;
}
<div class="alertor">
  <h1> Just a nice warming welcomer </h1>
  <p> Welcome user! How are you today? </p>
</div>

And nothing shows! The Javascript isn't responding and I don't know why. Can someone please help me?

Barmar
  • 741,623
  • 53
  • 500
  • 612

0 Answers0