JSFiddle - React, Tailwind, and code Playground

by chauhangs

HTML

<img alt="img-estate" src="images/estate.png" id="img-estate" />

<img alt="img-saloon" src="images/saloon.png" id="img-saloon"/>

JavaScript

$(function() {
 $('img').click(function(){
     var image =  $(this).attr('src');
     alert(image);
     var newimage = image.replace('.png','-active.png');
                                  alert(newimage);
     
   $(this).attr('src',"newimage");
   return false;
 });
});