JSFiddle - React, Tailwind, and code Playground

by calder12

HTML

<img class="gallery img" src="http://placehold.it/350x150" /><br />
<button id="change">Hi</button>
<label id="imgId"></label>

JavaScript

$("#change").on("click",function(){
    i=0;
    $('.gallery').attr('id', 'img'+i);
    $("#imgId").html($('.gallery').attr('id'));
});