This code is working on JSFiddle but It does not work on my script also, I get this error with Firebug
Where is my mistake?
TypeError:
document.getElementById(...) is null
document.getElementById("image").onclick = function() {
if (this.src == "https://i.stack.imgur.com/5FoXm.png?s=48&g=1") {
this.src = "https://i.stack.imgur.com/EoD62.jpg?s=32&g=1";
} else {
this.src = "https://i.stack.imgur.com/5FoXm.png?s=48&g=1";
}
};
tag, if it isn't there already.
– Matt Browne Sep 11 '16 at 11:12