I have an application form where I need to hide 2 different divisions/sections until the user clicks on the Yes radio button and then the hidden divisions/sections will appear. I've tried different solutions and have close to what I want, but with the current code, the hidden division/section is a large blank space. Here's what I hope to achieve: When the form is first opened, the input divisions/sections are hidden and there's no blank space. When the user clicks on the "Yes" radio button, the hidden divisions/sections will appear and the fields below will move down. There will be two hidden divisions/sections so the code for each is probably going to have some unique characters.
Here's my code so far:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="EWATV Membership Application">
<meta name="apple-mobile-web-app-title" content="EWATV Mbr App">
<title>EWATV Membership Application</title>
<!-- Script used for displaying CBO section:
Source for following script: https://codepen.io/Zillionx/pen/xwOxoW
-->
<script>
function CBO_Check()
{
if (document.getElementById('CBO_Yes').checked)
{
document.getElementById('ifYes').style.visibility = 'visible';
}
else document.getElementById('ifYes').style.visibility = 'hidden';
}
</script>
</head>
<body>
<br><br>
Do you represent a CBO?
<br>
Yes <input type="radio" onclick="javascript:CBO_Check();" name="yesno" id="CBO_Yes">
No <input type="radio" onclick="javascript:CBO_Check();" name="yesno" id="CBO_No">
<br>
<div id="ifYes" style="visibility:block">
<table>
<tr class="TEXT-ALIGN-CENTER TEXT-SIZE-20PT TEXT-COLOR-LIME-GREEN">
<th colspan="2" id="CBO_INFO">Club / Business / Organization (CBO)</th>
</tr>
<tr>
<td class="TEXT-ALIGN-RIGHT TEXT-BOLD TEXT-COLOR-RED">
<label for="CBO_NAME">CBO name:</label>
</td>
<td class="TEXT-ALIGN-LEFT">
<input type="text" name="CBO_NAME" id="CBO_NAME" size="65">
</td>
</tr>
<tr>
<td class="TEXT-ALIGN-RIGHT TEXT-BOLD TEXT-COLOR-RED">
<label for="CBO_MAIL_ADDRESS">CBO Mail address:</label>
</td>
<td class="TEXT-ALIGN-LEFT">
<input type="text" name="CBO_MAIL_ADDRESS" id="CBO_MAIL_ADDRESS" size="65">
</td>
</tr>
</table>
</div>
Do you own an OHV?
<br>
Yes <input type="radio" onclick="javascript:OHV_Check();" name="yesno" id="OHV_Yes">
No <input type="radio" onclick="javascript:OHV_Check();" name="yesno" id="OHV_No">
<br>
</body>
</html>
For brevity purposes, I have removed some of the fields from the hidden division/section.