JSFiddle - React, Tailwind, and code Playground
HTML
<form>Account Type:</br>
<label>
<input type="radio" name="accountType" value="public" checked>Public</label>
</br>
<label>
<input type="radio" id="professional" name="accountType" value="professional">Professional</label>
</br>
<label>
<input type="radio" id="distributor" name="accountType" value="distributor">Distributor</label>
</form>
</br>
</br>
<div id="form1">Profession:
<input type="text" name="profession">
</br>Company:
<input type="text" name="company">
</br>Zip Code:
<input type="text" name="zipcode">
</br>
</div>
<div id="form2" style="visibility: hidden;">Company:
<input type="text" name="company">
</br>Address:
<input type="text" name="address1">
</br>Address:
<input type="text" name="address2">
</br>City:
<input type="text" name="city">
</br>State:
<input type="text" name="state">
</br>Zip/Postal Code:
<input type="text" name="zipCode">
</br>Country:
<input type="text" name="country">
</br>
</div>
JavaScript
$('input[type=radio]').click(function(){
if (this.id == "professional") {
document.getElementById("form1").style.visibility = 'visible';
document.getElementById("form2").style.visibility = 'hidden';
}
if (this.id == "distributor") {
document.getElementById("form2").style.visibility = 'visible';
document.getElementById("form1").style.visibility = 'hidden';
}
});