Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
113
rated 0 times [  115] [ 2]  / answers: 1 / hits: 111729  / 13 Years ago, sat, july 23, 2011, 12:00:00

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


More From » html

 Answers
13
var image_x = document.getElementById('image_X');
image_x.parentNode.removeChild(image_x);


http://jsfiddle.net/5DdyL/


[#91037] Friday, July 22, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
turnerf

Total Points: 620
Total Questions: 101
Total Answers: 109

Location: French Polynesia
Member since Tue, Jul 7, 2020
4 Years ago
turnerf questions
;