The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery .remove() leaving traces of children?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #165849

    I’m making my own modal system, because learning.

    Here’s a pen:

    This isn’t the simplest way to show it, but it’s the only stage that I get this particular error.

    The current usage would be to click the video link, and to close it click outside the Youtube embed. That part works as intended, but if you click on the link again, it shows two of the .video-container divs.

    I read up on .remove() and it’s supposed to clear out children. Inspecting the DOM does indeed show everything gone until clicking the video link again. Each time you click, there will be another .video-container div inside .modal-box.

    Side note – the youtube video itself isn’t loading on CodePen, however my local environment it is. I don’t believe it has to do with this, unless it does…

    What am I doing wrong?

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.