JSFiddle - React, Tailwind, and code Playground

by writetobhuwan

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 here1
</div>
<div id="g2" class="gSet">
  content here2
</div>
<div id="g3" class="gSet">
  content here3
</div>
<div id="g4" class="gSet">
  content here4
</div>

JavaScript

$('input:radio').on('change',function(){
    $('#g'+$(this).val()).show().siblings('div').hide();
});