I'm having trouble with an IF statement that checks a DOM element and replaces the current src with a new src. In the code below, I know the source for sceneImageID is the image after the ==, yet the IF statement does not trigger.
var scene = document.getElementById('sceneImageID').src;
console.log("scene before if: " + scene);
if (scene.endsWith == "Media/Town/Town_bw.png") {
scene = "Media/Town/Town_bw_noscrap.png";
console.log("inside if statement: " + document.getElementById("sceneImageID").src);
}
EDITS: added the .endsWith piece, but I'm having the same issue of it not entering the IF statement.
The first console returns: http://34.68.254.120:8080/Media/Town/Town_bw.png
Thanks in advance.
console.log(document.getElementById('sceneImageID').src);