JSFiddle - React, Tailwind, and code Playground
HTML
<img class="image" src="http://pic.1fotonin.com/data/wallpapers/93/WDF_1369581.jpg" />
<img class="image" src="https://c7.staticflickr.com/3/2538/3742771246_2648fa4e6e_b.jpg" />
CSS
.image{
width:200px;
}
JavaScript
$('.image').click(function(){
// Create an auxiliary hidden input
var aux = document.createElement("input");
// Get the text from the element passed into the input
aux.setAttribute("value", $(this).attr('src'));
// Append the aux input to the body
document.body.appendChild(aux);
// Highlight the content
aux.select();
// Execute the copy command
document.execCommand("copy");
// Remove the input from the body
document.body.removeChild(aux);
alert($(this).attr('src'));
});