How to remove src attribute of iframe on a lightbox using jQuery?
<p>A few days ago I asked here about how to add src attribute to iframe using jQuery. I actually got a code but it's not working. I have just started studying jQuery so maybe, I thought, there was something I missed. Now I got a code that's working, but the problem is when I close the lightbox, the video on the iframe continues streaming... How do I fix it? Here's my current code:</p>

<pre><code>$("#presentation").click(function(){

     $("#iframe-presenter").get(0).contentWindow.location.href ='example.com';

});

$(".Close").click(function(){

     $("#iframe-presenter").get(0).contentWindow.location.href = '#';

});
</code></pre>

<p>I am thinking of refreshing the page in the event of closing the lightbox, but I think it's too distractive. Any help pls?...</p>

<p><strong>UPDATE:</strong></p>

<p>Ok so this one works: </p>

<pre><code>$("#iframe-presenter").remove();
</code></pre>

<p>However, when relaunching the lightbox no video will appear since the code snippet above removes the iframe wich is <code>#iframe-presenter</code>. My solution now is:</p>

<pre><code>$('.Close').after('&lt;iframe id="iframe-presenter" src="example.com"&gt;&lt;/iframe&gt;');
</code></pre>

<p>As you can see, jQuery now creates the iframe markup instead of HTML. So when I close the lightbox, it would still be able to load the iframe. But, it seems to load two streams at the same time even on first launch? </p>

<p><strong>UPDATE 2:</strong></p>

<p>Solved. <code>.Close</code> is a class so I made an ID for it...</p>
