0

I want to apply a class just for 3 seconds, why is the class not being removed.

var x = 0;
var notes = ['a','b','c'];
while (x < notes.length) {
  document.getElementById(notes[x]).classList.add('active');
  x++;
}
function RemoveClass() {
  var x = 0;
  while (x < notes.length) {
    document.getElementById(notes[x]).classList.remove("active");
    x++;
  }
  
}
window.setTimeout(RemoveClass, 3000);
.active{color:blue}
<div id="a">First</div>
<div id="b">Second</div>
<div id="c">Third</div>
Roy Bogado
  • 4,299
  • 1
  • 15
  • 31
moon
  • 1

0 Answers0