JSFiddle - React, Tailwind, and code Playground
by learner001
HTML
<div class="change">
<div class="col-md-2">
<a href="#" class="add"><h4> Add </h4></a>
</div>
<div class="col-md-10">
Hello
</div>
</div>
JavaScript
$("body").on("click", "a.add", function(){
$(this).removeClass('add').addClass('subtract').html('<h4>Subtract</h4>')
$(this).parent().next('div').text('This section is for subtract content')
});
$("body").on("click", "a.subtract", function(){
$(this).removeClass('subtract').addClass('add').html('<h4>Add</h4>')
$(this).parent().next('div').text('This section is for add content')
});