JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<img src="whatever" alt="test" onclick="close('test')">
</div>
JavaScript
console.log('hi');
function close(template) {
console.log(template);
$('body').find('img[alt="'+template+'"]').remove();
}