JSFiddle - React, Tailwind, and code Playground

HTML

<div class="div1">
    <a class="myimg" href="#">clickme1</a>
    <span>myspan1</span>
    </div>

    <div class="div2">
     <a class="myimg" href="#">clickme2</a>
      <span>myspan2</span>
    </div>

JavaScript

$(function () {
    $("a").click(function () {
        $(this).next("span").html("Span Changed")
    });
});