How can I change the src
attribute of an img
tag using javascript?
Maybe because you have a tag like a parent of the tag. That why you have to click two time the images.
For me the solution is this: http://www.w3schools.com/js/tryit.asp?filename=tryjs_intro_lightbulb
Give your img tag an id, then you can
document.getElementById("imageid").src="../template/save.png";
Give your image an id. Then you can do this in your javascript.
document.getElementById("blaah").src="blaah";
You can use the ".___" method to change the value of any attribute of any element.