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 youtube video to a div location on the page)
I need to remove the iframe once the user starts clicking on the images again.
var $video=$('div.icon iframe');
var $productImage=$('.product-image');
var $icon=$('.icon');
$icon.on('click',function()
{
$('.product-image').append($video);
});
EDIT: sorry i meant remove
http://jsfiddle.net/t7qMF/1/
To hide:
To 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.