I would like to click on an image and display another one in the place, then click again and display another one and so on until returning to the original image.
I can only display one image. I started to study javascript quite a bit and not about what to look for to solve this.
function trocar(i) {
if (i == 1) {
document.getElementById("agni").src="img/gods-skin/agni-swagni.jpg"
}
<img id="agni" onclick="trocar(1)" alt="hindu" class="img-gods expand" src="img/gods/agni.jpg">
Thank you if anyone can help