JSFiddle - React, Tailwind, and code Playground

by Cioc Andrei

HTML

<div class="pricing_table" id="addDeal">
<h2>Monthly Plans</h2>
<button class='plansSwitch' href='#searchDeal'>Click here to switch to the "Yearly Plans"</button>
</div>
<div class="pricing_table" id="searchDeal">
<h2>Yearly Plans</h2>
<button class='plansSwitch' href='#addDeal'>Cancel</button>
</div>

JavaScript

var $plansHolders = $('#addDeal, #searchDeal').hide();
$('#addDeal').show();
$('.plansSwitch').click(function() {
  var href = $(this).attr('href');
    console.log(href);
  $plansHolders.hide();
  $(href).show();
})