This is a discussion on "on selecting this radio button, set the class of this div to this" within the JavaScript Forum section. This forum, and the thread "on selecting this radio button, set the class of this div to this are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
on selecting this radio button, set the class of this div to this
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
on selecting this radio button, set the class of this div to this
hello masters of the js universe, I need some assistance.
I have 3 or so radio inputs and upon clicking them I'd like an enclosing div tag to have a css class applied to it. Then, upon clicking one of the other radio inputs I'd like the class on the previously selected input to be deactivated. The form I'm referring to with this is at http://triumphantevents.co.uk/events...=djd-bt_busrel With the enclosing div tag, is the concept to give it an id? and then on the radio button something like:
Thanks for any help on this. Last edited by cosmicbdog; Dec 13th, 2007 at 07:40. Reason: more info to help the cause |
|
|
|
#2
|
||||
|
||||
|
Re: on selecting this radio button, set the class of this div to this
Okay, this is a fairly simple task
what you want is to set up a function somewhere
Fairly simple example above but it should perform the task
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#3
|
|||
|
|||
|
Re: on selecting this radio button, set the class of this div to this
I have been studying this post for a week, honestly. It is gradually making sense to me.
|
|
#4
|
||||
|
||||
|
Re: on selecting this radio button, set the class of this div to this
LOL, sorry, I normally comment my examples...
The function takes two arguments, the id of a HTML element and the name of the class that this element will receive. Within the function, the first line is storing a reference to the html element with the next line setting the className property to the given class. The HTML code contains a ternary function call esentially, when the radio button is clicked, it checks whether that click has resulted in the radio button being selected. If it has, it runs the function giving it an element id and a class name. If it turns out that this click has resulted in the radio not being checked any longer, nothing happens. Hope that makes it a bit clearer.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] Selected radio button value | Pugger | JavaScript Forum | 8 | Nov 3rd, 2007 12:16 |
| radio button interfering with drop down | antonyx | JavaScript Forum | 1 | Apr 27th, 2007 00:11 |
| Any way to use an image for a radio button? | masonbarge | Web Page Design | 23 | Jan 6th, 2007 09:06 |
| automatic pop-up when click on a radio button | joshcxa | JavaScript Forum | 2 | Aug 1st, 2006 06:06 |
| Help Please - Radio Button Labels not showing | sandyb | Flash & Multimedia Forum | 0 | Jan 16th, 2006 22:56 |