JSFiddle - React, Tailwind, and code Playground

by robert_schutt

HTML

<a ontouchstart="" href="/product-code.html"><img class="aImage" src="images/T/product-image.jpg" alt="product name" /></a>

JavaScript

$('a').click(function(e){
    e.preventDefault();
    alert($(this).find('img').attr('src') + ' / ' + $(this).find('img').attr('class'));
});

if (window.screen.width > 768) {
    $('.aImage').attr({
        class: 'big-img',
        src: function(idx, src) {
            return src.replace('/T/', '/P/');
        }
    });
}