jquery hide all open divs and toggle

Posted by Kyle on Stack Overflow See other posts from Stack Overflow or by Kyle
Published on 2011-02-05T22:43:34Z Indexed on 2011/02/05 23:25 UTC
Read the original article Hit count: 259

Filed under:
|

I have 2 links and depending on which one they click on want to close all others and show only the information for that link.

Example:

<div class="shipping-container">
    <a href="#" class="ups">Show UPS info</a>
    <a href="#" class="fedex">Show Fedex info</a>
    <div class="ups info" style="display:none">the info for ups</div>
    <div class="fedex info" style="display:none">the info for fedex</div>
</div>

Any ideas how I can do this with Jquery toggle for clicking one of the links and hide all others if there open. I only want to show info for one shipping method at a time. Also I would like an option for the user to click showall and all of them are displayed, if possible. Thanks in advance....

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about toggle