Jquery If Statement And Remove Iframe
How do i write an if statement in jquery: IF the user clicks on an image div#ProductImages > img then hide/remove the iframe? This is what i have: (my code will append the youtu
Solution 1:
To hide:
$('#my-iframe').hide();
To remove:
$('#my-iframe').remove();
It is not clear from your example what logic you're trying to place where.
But you would need some kind of click listener.
$('#my-image').click(function() {
// hide or remove iframe
});
Solution 2:
Append the $video and toggle visibillity
var$video=$('div.icon iframe');
var$productImage=$('.product-image');
var$icon=$('.icon');
$('.product-image').append($video);
$icon.on('click',function()
{
$video.toggle();
});
I hope I understood you correctly
Post a Comment for "Jquery If Statement And Remove Iframe"