473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

hide textboxes through radiobutton-clicks

I want to hide the 2 text boxes when i'm clicking on radio button using javascript how can i do? Please suggest me do
Dec 25 '07 #1
3 1479
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN ...

here you have an example :)

[HTML]<html>
<script type="text/javascript">
function hide_boxes(state) {
var boxes = {
t1: document.getElementById('t1'),
t2: document.getElementById('t2')
};

for (var i in boxes) {
boxes[i].style.visibility = state ? 'hidden' : 'visible';
}
}
</script>
<body>
<label for="r1">show</label>
<input type="radio" id="r1" name="box_hide" onclick="hide_boxes(false);"/>
<label for="r2">hide</label>
<input type="radio" id="r2" name="box_hide" onclick="hide_boxes(true);"/>
<div>
<input type="text" id="t1"/>
<br/>
<input type="text" id="t2"/>
</div>
</body>
</html>
[/HTML]
kind regards

ps: please use good thread titles ...
Dec 25 '07 #2
Thanks for the answer. How to do the same thing using jquery in rails?
Dec 26 '07 #3
gits
5,390 Expert Mod 4TB
:) i'm not familiar with jquery and rails ... so read the api-docs or may be sombody other jumps in and might help you ...

kind regards
Dec 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: VK | last post by:
Hi! What I'm missing in following code? Cannot get the values of radiobuttons. Starting only one class (GetVariant), it works. When I put two classes together, it doesn't. Regards, VK from...
3
by: sofie | last post by:
Hello all, I use the following javascript function in a html document to set the level of one of eight available radiobuttons. The line that's commented out works fine under IE, but I need to...
3
by: Jason | last post by:
I am new to WebForms and am far more comfortable with WinForms. I am wondering how simple things such as showing/hiding a label and textbox can be accomplished if a certain Radiobutton option is...
5
by: dje | last post by:
In the OnClick event on a radioButtonList, I run a javascript to show/hide the appropriate div along with a submit button, which displays as expected. The problem is the submit no longer works on...
1
nev
by: nev | last post by:
After adding a datasource, I can see my tables in the right-pane of my IDE. Some tables I placed on my form as a datagrid and others as detail view (textbox w/ labels). Hiding a column in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.