We help IT Professionals succeed at work.
Get Started

How to hide text box by javascript

Tree_PRO
Tree_PRO asked
on
2,052 Views
Last Modified: 2013-11-19
Dear experts,

I have a form that include 3 different text box along with their radio input for each one.

what I want is that when the user click in the first radio input then it text appear and the other are hidden and when the user click the second radio then it text box appear and others are hidden.

I attached three different photos that describe what I want to do , the photos were edited by Photoshop. And also I attached the form code.

Thanks in advance.
Regards.
<form method="POST" name="test">
	<div align="center">
		<table border="0" width="500">
			<tr>
				<td><input type="radio" value="V1" name="R1" checked>option 1
				</td>
				<td><input type="radio" value="V1" name="R1">option 2 </td>
				<td><input type="radio" value="V1" name="R1">option 3 </td>
			</tr>
			<tr>
				<td>
	<input type="text" name="T1" size="20" value="text1"></td>
				<td>
	<input type="text" name="T2" size="20" value="text2"></td>
				<td>
	<input type="text" name="T3" size="20" value="text3"></td>
			</tr>
		</table>
	</div>
	<p align="center"><input type="submit" value="Submit" name="B1"></p>
</form>

Open in new window

1.gif
2.gif
3.gif
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 2 Answers and 5 Comments.
See Answers
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