views:

22

answers:

1

Hey everyone I got a javascript problem I can't seem to find a specific solution for on the web. What I want to be able to do is select one of the radio buttons and have that change the class of #home-right to either .rackmount or .shipping and add the class of .displaynone to the type of dimensions I don't want shown.

<div id="home-right" class="rackmount">
            <h4 class="helvneuebcn">Case Finder</h4>

            <div class="cta-options">
                <input type="radio" value="Shipping and Storage" name="" checked> Shipping and Storage<br/>
                <input type="radio" value="Rackmount Enclosures" name=""> Rackmount Enclosures<br/>
            </div>

            <div class="shipping-dimensions displaynone">
                <div class="dimensions"><input type="text" class="size"><span class="helvneuemd">H x </span></div>
                <div class="dimensions"><input type="text" class="size"><span class="helvneuemd">W x </span></div>
                <div class="dimensions"><input type="text" class="size"><span class="helvneuemd">L</span></div>
            </div>

            <div class="rackmount-dimensions">
                <div class="dimensions"><input type="text" class="size"><span class="helvneuemd">U Height x </span></div>
                <div class="dimensions"><input type="text" class="size"><span class="helvneuemd">Rack Depth</span></div>
            </div>

            <div class="clear"></div>

            <input type="button" value="Submit" class="findcase">
</div>
A: 

Use a onClick handler on your radio buttons to do your stuff. Example:

<input onCLick="..." type="radio" value="Shipping and Storage" name="" checked> Shipping and Storage<br/>

Also use jQuery if you ain't already - it will save you some time and its very easy to do this kind of functionality.

zaf
from what I've seen the onclick is necessary for sure, but what I'm unsure about is the javascript to make it happen. I am not aware of any jq plugin that can do this...
Rob
With jquery its very easy to select elements and add/remove css classes. Seriously, if you've never had a go, try it. Really easy to install and play with. Just post a message if you get stick somewhere.
zaf