JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Hover over image to see title. <br />
Click Image to toggle the "alt" text to be visible.<br />
<img
src="https://www.blogger.com/img/blogger-logotype-color-black-2x.png"
alt="my alt"
title="my title">
<div id="show-text"></div>
JavaScript
$("img").on("click", function() {
if( !$.trim( $('#show-text').html() ).length ) {
$("#show-text").text($(this).attr("alt"));
} else {
$("#show-text").text("");
}
});