JSFiddle - React, Tailwind, and code Playground

by mohammadAdil

HTML

<input type="radio" name="sNum" value="1"><span>1</span>

<input type="radio" name="sNum" value="2"><span>2</span>

<input type="radio" name="sNum" value="3"><span>3</span>

<input type="radio" name="sNum" value="4"><span>4</span>

<br />
<div id="g1" class="gSet">content here</div>
<div id="g2" class="gSet">content here</div>
<div id="g3" class="gSet">content here</div>
<div id="g4" class="gSet">content here</div>

JavaScript

$('div.gSet').hide();
  $('input').on('change', function () {
      var val = $(this).val();
      $('div.gSet').hide();
      $("div.gSet:lt(" + val + ")").show();
  });