JSFiddle - React, Tailwind, and code Playground
HTML
<img src='/images/test.jpg' />
<img src='/images/test2.jpg' />
JavaScript
//Grabs entire path
//$('img').click(function()
//{
// alert($(this).attr('src'));
//});
//Will grab the image regardless
$('img').click(function()
{
var test = $(this).attr('src').split('\/');
alert(test[test.length-1]);
});