JSFiddle - React, Tailwind, and code Playground

HTML

<div id="g1">
    <span onclick="alert('hey')">hey</span>
    <span onclick="alert('second hey')">second hey</span>
</div>

<div id="a2">
    <img id="img" src="https://www.google.com/images/srpr/logo3w.png"/>
</div>

JavaScript

$(function() {
    $(document).on('click', '#img', function(){
        $('#g1 > span:first-child').click();
        //$('#g1 > span:first-child').trigger('click')
    });
});