I faced a problem as to remove image with JS code like a...
...
document.getElementById(\'image_X\').src=\'\'
Try using:
document.getElementByID("").style.visibilty="hidden";
when you do not want to show the image and
document.getElementById("").style.visibility="visible";
when you want to show the image.
To delete an image in JavaScript (or generally to delete anything), first you should grab the element, then traverse to its parent element, then you can delete the child using removeChild
method.
1) remove img element using parent node. 2) Then, Store that parent node. 3) Then, create new img element in that parent node.