I am trying to create a section, where by selecting a radio button a specific section will get the class active added to it, making it visible. All sections will be hidden initially, but .stage1-row should initially be active, as per the first radio button, which is checked by default. When you click on any of the other radio buttons, the section that's currently 'active' should drop this class so that the other one takes its place. So far I've only managed to attach a class to the radio button itself, but that's not what I need. Is this possible? Here is the base of what I'm trying to achieve.
.stage1-row,
.stage2-row,
.stage3-row,
.stage4-row {
display:none;
}
.stage1-row.active,
.stage2-row.active,
.stage3-row.active,
.stage4-row.active {
display:block;
}
<div class="delimiter">
<form>
<ul>
<li><label><input name="stage" type="radio" value="stage1" checked>Stage 1</label></li>
<li><label><input name="stage" type="radio" value="stage2">Stage 2</label></li>
<li><label><input name="stage" type="radio" value="stage3">Stage 3</label></li>
<li><label><input name="stage" type="radio" value="stage4">Stage 3</label></li>
</ul>
</form>
<div class="stage1-row active">
Stage 1 content
</div>
<div class="stage2-row">
Stage 2 content
</div>
<div class="stage3-row">
Stage 3 content
</div>
<div class="stage4-row">
Stage 4 content
</div>
</div>