JSFiddle - React, Tailwind, and code Playground

by LinkinTED

HTML

<div class="imageBox">
    <img src="http://nettuts.s3.amazonaws.com/254_apps/images/200x200.png"/>
    <img src="http://davidnaylor.org/temp/firefox-logo-200x200.png"/>
    <img src="http://davidnaylor.org/temp/thunderbird-logo-200x200.png"/>
</div>

JavaScript

$(document).ready( function() {
    $(".imageBox img").hide();
    $(".imageBox img:first-child").show();
});

$(".imageBox img").on( "click", function() {
    if( $(this).next().length > 0 ) {
        $(this).hide();
        $(this).next().show();
    }
    else {
        $(this).hide();
        $(".imageBox img:first-child").show();
    }
});