JSFiddle - React, Tailwind, and code Playground

by jesus_tesh

HTML

<p>Make a selection and press the button</p>
<ul>
    <li>
        <input type="radio" name="g" value="one" id="one" />
        <label for="one">Option A</label>
    </li>
    <li>
        <input type="radio" name="g" value="two" id="two" />
        <label for="two">Option B</label>
    </li>
    <li>
        <button id="btn">Submit</button>
    </li>
</ul>
<div style="display: none;">
    <div id="one-content">Lorem ipsum dolor sit amet.</div>
    <div id="two-content">Proin eu sapien risus. Donec.</div>
</div>
<p id="output"></p>

CSS

ul, li {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

JavaScript

$("#btn").on("click", function () {
    var selected = $("input[name=g]:checked").val();
    var content = $("#" + selected + "-content").html();
    $("#output").html(content);
});