This question has been asked before, but none of what I've found works. I need to switch an image to another on click, and then back with another click.

```
<img id="searchicon" src="ddg.png" width="26px" height="26px" 
     onclick="this.src = ((this.src === 'ddg.png') ? 'logo.png' : 'ddg.png');">

```

This should work. `onclick` should be comparing `src` to `ddg.png` and returning true, replacing `src="ddg.png"` with `src="logo.png"`. However, it doesn't. If I change the original `src` to `logo.png` (or change the order of the operator), the operator will switch to `ddg.png`, but not back to `logo.png`. I have no clue why this is happening. No console errors are being produced. I have also tried writing this operator in a separate file and linking it in, as well as writing `if..else` statements. They all will switch from `ddg.png` to `logo.png`, but not the other way.