JSFiddle - React, Tailwind, and code Playground
HTML
<div id="d1">
<div class="c1">
<a href="#"><img src="http://i.imgur.com/tL6nW.gif"></a>
<a href="#"><img src="http://i.imgur.com/BfZ5f.gif"></a>
<a href="#"><img src="http://i.imgur.com/mR7wo.gif"></a>
</div>
</div>
<div id="d"></div>
JavaScript
$(function() {
var $images = [];
$("#d1 > .c1 > a").each(function() {
$images.push($("img", this).attr("src"));
});
var $length = $images.length;
var $imgShow = 0;
$("#d1 > .c1").html( $("#d1 > .c1 > a:first") );
$("#d1 > .c1 > a").click(function(event) {
$(this).children().attr("src", $images[++$imgShow % $length]);
event.preventDefault();
});
});