JSFiddle - React, Tailwind, and code Playground

by simpleorchid

HTML

<button id="A">A</button>
<button id="B">B</button>

JavaScript

$("#A").on('click',function(){
   alert($(this).text());
   $(this).text("B");
   $(this).siblings("#B").text("A"); 
    
});

$("#B").on('click',function(){
   alert($(this).text());
    $(this).text("A");
    $(this).siblings("#A").text("B");
});