We help IT Professionals succeed at work.
Get Started

hiding a div until multiple radio buttons are checked

whaleyk asked
Last Modified: 2012-05-11
I was really trying to figure this one out by myself, but I'm runing out of time as usual.  I just need to hide div="agree" until all questions have been answered (there will be many more than just these 2).  I'm currently displaying the div after answering just one.

Thanks as always.
<title>Thank you!</title> 

<script type="text/javascript"> 

function doCheck()
	var i=1, j=1
	while(document.getElementById("q" + i + "_" + j) == null){
         document.getElementById("agree").style.display = "none";
	document.getElementById("agree").style.display = "block";

<form name="form1" id="form1" method="post" action=""> 
<td width="200">
<input type="radio" name="q1" id="q1_1" value="a1" onclick="doCheck()">1<br>
<input type="radio" name="q1" id="q1_2" value="a1" onclick="doCheck()">2<br>
<input type="radio" name="q1" id="q1_3" value="a1" onclick="doCheck()">3<br>
<input type="radio" name="q2" id="q2_1" value="a1" onclick="doCheck()">1<br>
<input type="radio" name="q2" id="q2_2" value="a1" onclick="doCheck()">2<br>
<input type="radio" name="q2" id="q2_3" value="a1" onclick="doCheck()">3<br></td> 
<td><div class="hide" id="agree">Keep me hidden until both questions one and 2 have bene hiden</div></td> 
<td colspan="3">&nbsp;</td> 

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE