I’m making my own modal system, because learning.
Here’s a pen: http://codepen.io/drainpip/pen/IgCzq
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?