how can i remove a element from the dom in javascript?

You just need to .remove() it, but you’d want the interval to go for 50 more ms so that there’s time for the element to be visible at 0.1 opacity, else it might look a bit off:

function fadeOut(event){
  var op = 1;  // initial opacity
  var timer = setInterval(function () {
    if (!op){
    } = op;
    op -= 0.1;
  }, 50);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top