I faced a problem as to remove image with JS code like a...
<img src="image.png" id='image_X'>
...
document.getElementById('image_X').src=''
Image stays unchanged :( So my question is how to remove image with JS? To be more detailed... How to modify the image src attribute value dynamically?
Any useful comment is appreciated
The JavaScript delete operator removes a property from an object; if no more references to the same property are held, it is eventually released automatically.
Approach: Select the HTML element which need to remove. Use JavaScript remove() and removeChild() method to remove the element from the HTML document.
var image_x = document.getElementById('image_X');
image_x.parentNode.removeChild(image_x);
http://jsfiddle.net/5DdyL/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With