JSFiddle - React, Tailwind, and code Playground

by Sean Wessell

HTML

<form action="code" method="get">
    <br>
     <h6>My question here:<br>
<input name="example" value="yes" type="radio">Yes<br>
<input name="example" value="no" type="radio">No<br></h6>

    <div id="optionalInfo">
        
<h6>Please enter the information below:</h6>

        <input name="email" placeholder="[email protected]" type="email">
        <br>
        <br>
        <input name="phone" placeholder="(###)###-####" type="tel">
        <br>
        <br>
    </div>
    <input value="Continue" type="submit">
</form>

CSS

#optionalInfo{
    display: none;
}

JavaScript

$('[name="example"]').click(function () {
        $('#optionalInfo').toggle((this.value == 'yes'))
})