JSFiddle - React, Tailwind, and code Playground

by wrxsti85

HTML

<div>
    
    <div> 
        <a class="txt">Some text</a>
    </div>
    
    <div> 
        <a class="txt">Some text</a>
        <button id="button">button</button>
    </div>

</div>

JavaScript

$("#button").on('click', function () {
    $(this).parent().prev().find('.txt').text("some more text");
});