473,386 Members | 1,766 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,386 software developers and data experts.

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

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=rbIntrusionDetectC 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 14378
JKing
1,206 Expert 1GB
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
Here's the code I'm using to hide the button, but it doesn't hide the label of the button.

document.getElementById ('rbIOSFirewallC').style.visibility='hidden';
Oct 8 '10 #3
JKing
1,206 Expert 1GB
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='hidden'; 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
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
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
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)...
1
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...
2
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...
8
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)...
8
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...
8
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...
4
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. ...
3
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...
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.