JSFiddle - React, Tailwind, and code Playground

by bluey

HTML

<div id="container">
   <div>
      old content abc <span class="change">switch</span>
   </div>
   <div>
      new content abc  
   </div>

   <div>
      old content 123 <span>switch</span>
   </div>
   <div>
      new content 123  
   </div>

</div>

JavaScript

$('.change').mouseleave(function() {
    $this = $(this)
    $(this).parent("div").hide().append($this);
});

$('#container').children().hide();
$($('#container').children()[0]).show();