473,569 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to to hide a radio button option along with it's label?

3 New Member
Hi Everyone.
It may be simple, I dunno... I never had to do this before and for the life of me I can't find anything on the net so far.
I have a radio button group (which I'll post after this message). I have to hide a radio button option with it's label. ie: in the example below, I want to hide option id=rbIntrusionD etectC along with the CEP label. Is this possible using javascript?
I was able to hide the actual radio button, but not the corresponding label.
Your help is much appreciated.
Thanks.
D.

Expand|Select|Wrap|Line Numbers
  1. <div id="rbIntrusionDetect_div"
  2.   class="showControl"><input type="radio" name="ui.rbIntrusionDetect.value" id="rbIntrusionDetectY" value="Y"/><label for="rbIntrusionDetectY">Yes</label>
  3. <input type="radio" name="ui.rbIntrusionDetect.value" id="rbIntrusionDetectN" value="N"/><label for="rbIntrusionDetectN">No</label>
  4. <input type="radio" name="ui.rbIntrusionDetect.value" id="rbIntrusionDetectC" value="C"/><label for="rbIntrusionDetectC">CEP</label>
  5.  
  6. </div>
Oct 8 '10 #1
5 14432
JKing
1,206 Recognized Expert Top Contributor
How are you hiding the radio button? You should be able to apply the same method to your label whether it be javascript or jquery.
Oct 8 '10 #2
Dan Boyce
3 New Member
Here's the code I'm using to hide the button, but it doesn't hide the label of the button.

document.getEle mentById ('rbIOSFirewall C').style.visib ility='hidden';
Oct 8 '10 #3
JKing
1,206 Recognized Expert Top Contributor
The label is a separate element so you would also need to hide it.

Add an id to your label and hide it the same way.

Make note that using visibility='hid den'; hides the element but the element still occupies the space it was in.

If you need to remove the element from view and spacing you can use style.display=' none';.
Oct 8 '10 #4
Dan Boyce
3 New Member
Thanks JKing, but I don't think that's going to work for me. The radio tags are generated with struts (which I'm very weak in.... it creates the radio tags with the <s:radio tags in struts) I've been looking around the net for ways to insert that ID to the label portion of the radio button using struts but I can't the method to do this. I'll have to do a bit more digging around to see if there's some bastardized way of doing this since it's just for the 1 field.

Thanks again for your help and suggestion.
Cheers.
Oct 8 '10 #5
candidjava2
3 New Member
I think you failed to add xml files and tld files file here is the better way to resolve your problem refer this site http://candidjava.com/struts-tutorail
Jan 13 '12 #6

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

Similar topics

3
2347
by: ewitkop90 | last post by:
Here is my code: <SCRIPT> function transportchange(transport) { if (framenewinstall.Helpdesk.checked) framenewinstall.Helpdesk.checked=false; if (framenewinstall.CircuitNumber.checked) framenewinstall.CircuitNumber.checked=false; switch (transport) { case 0: Helpdesk.innerText="No Info Needed";
1
3377
by: MickG | last post by:
I am trying to change the value of the variable "hard" according to which radio button is pressed and I am having no joy. Could anyone help me with this, the problematic section is marked with ***********************, I've included all the code incase that isn't where the problem is. Any help would be hugely appreciated. Mick
2
3482
by: Advo | last post by:
Basically, ive got information in a table for the layout purposes, as its text for a questionnaire What i Need, is for instance when the user click a radio button, that information can be hidden. I tried <div id="myarea" style="visibility:hidden"><STRONG><font color="#4475AA"Question 2:</font></STRONG></divetc
8
4603
by: photoboy | last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve: First, I have two radio buttons (both unchecked) that need to be validated when the submit button is clicked. Instead of the standard alert window popping up (which I have now), I want the radio...
8
2968
by: crayfiss | last post by:
Hi, firstly I am a total freshie in all this. From what I have gathered on the web and this forum, I finally managed to get my form up. I have a set of radio buttons with values to it and a select box with values too. Depending on the options selected from the two, the values will be calculated and displayed. everything worked fine with the...
8
2754
by: William Gill | last post by:
I have a simple registration form that needs a binary answer (one or the other) in several places, using radio buttons. Since at least one radio button in a group should be checked initially, and I don't want it to default to either, I am using a third option as the default (checked). Rather than have that third option say something like "you...
4
3017
by: pureadrenaline | last post by:
Hey Guys, Please could anyone help me out with the following form I need to create a validation on the email field only if the user checked the radio button named Email. Thanks in advance. <form action="" method="get"> <div align="center"> <table border="0" cellspacing="0" cellpadding="0">
3
6869
by: ToddFur | last post by:
I see several postings on this but I am still unable to figure out my problem. I can pass the values of my text field but not radio button (or even checkboxes). My PHP file <?php //declare our variables $day = $_GET; $date = $_GET; $groupname = $_GET;
2
4190
by: Remco | last post by:
Hello, I'm designing a simple website for my football team where we can tell each other if we're able to play next weekend. For this website I designed a page with radio buttons with the options: Attending, Not Attending, Unknown (standard option). But i'm not sure how to save the information from the radio buttons to the database and how...
0
7700
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.