JSFiddle - React, Tailwind, and code Playground

HTML

<img src="white.png" width="25px" height="25px" alt="1" id="star1" onmouseover="starOverOne()" onmouseout="starOutOne()"/>

JavaScript

$('img').click(function () {
    var alt = $(this).attr("alt")
    alert(alt);
});