Sería mejor: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> btn.onclick = function() { var src = jQuery(this).attr('data-video'); jQuery(".embed-container").html('<iframe src="'+src+'" width="640" height="340" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="top:-350px;"></iframe>'); modal.style.display = "block"; jQuery('header').css('display','none'); } span.onclick = function() { jQuery(".embed-container").find('iframe').remove(); modal.style.display = "none"; jQuery('header').css('display','block'); } <!-- end snippet -->