Changing classes on multiple divs when selecting specific radio buttons

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-04-08T16:12:26Z Indexed on 2010/04/08 16:23 UTC
Read the original article Hit count: 387

Filed under:
|
|
|

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>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about beginner