Hi,
I have added a image using the statement $(this).parent().siblings().children('#control).before("");
On click of another button I want to remove the appended image.
How to do it. Need help.
Hi,
I have added a image using the statement $(this).parent().siblings().children('#control).before("");
On click of another button I want to remove the appended image.
How to do it. Need help.
Give it an ID or suitable identifier such as a class, then remove it by selector:
$('#img').remove();//by id
$('.myImg').remove();//by class
Hi, I haven't tested this, but I know of the prev() function, so assuming you don't prepend that image more than once, maybe try:
$(this).parent().siblings().children('#control).prev().remove()
There are multiple ways of doing so:
Then just use whichever selector is needed for the method you choose and call:
$('#uniqueID').remove();
$('.className').remove();
imageReference.remove(); // if you did var imageReference = $(this).parent().siblings().children('#control).before("");