I'm trying to create a simple code where if the user clicks on the gif, it'll switch to another gif repeatedly until it reaches the end of the loop, where the loop restarts. This is the relevant chunk of code:

```
var storedColoredGif = document.getElementById("coloredGif"); //we grab the gif and store it in storedColoredGif
var onGifClick = function(){
    if (document.getElementById("coloredGif").src === "/images/green.gif"){
        document.getElementById("coloredGif").src = "/images/blue.gif";

    } else if (document.getElementById("coloredGif").src == "/images/blue.gif"){
        document.getElementById("coloredGif").src = "/images/yellow.gif";

    } else if (document.getElementById("coloredGif").src == "/images/yellow.gif"){
        document.getElementById("coloredGif").src = "/images/red.gif";

    } else if (document.getElementById("coloredGif").src == "/images/red.gif"){
        document.getElementById("coloredGif").src = "/images/green.gif";
    }}
storedColoredGif.addEventListener("click", onGifClick);

```

It's very straightfoward. All of the path names are correct and the gifs source is initially green. The program stores the gif in a variable, then in the function it checks for what the source of the gif is and changes it accordingly when the user clicks on the gif. But nothing happens when I click on it. Am I doing something wrong in my loops? If I had to guess, the problem is that I am correctly changing the source, its just that im never updating the html (but refreshing the page would set the gif to green again because thats what i set in the main html body). What am I doing wrong?

This is how the gif is put in the html (the green.gif is shown fine, its just that its not switching between the gifs when clicked)

```
    <img src="/images/green.gif" id="coloredGif" title="Click me!">

```

FINAL EDIT: thanks to 2 very helpful users below I was able to figure out that getting the src of the gif actually returns the full domain path, and as such my if statements never progress because theyre always false. Both of their solutions worked.

The solution was to simply work around the fact that checking the src returned the full domain path, instead of just the folders and gif path