Navigation Menu
Alphabetical Listing
Site Contents

Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Become a Partner

Internet.commerce

Be a Commerce Partner














Internet.com

IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Developer Channel

FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

Great Sites

DocJavaScript.com
dhtml.com
The Freebie Directory
TheFreeSite.com

Browse Doc JS's Tips!


Hiermenus Central


Promotions

Free Announcements


Social Bookmark

General

Display/hide information by just clicking a header. Previously opened section will be hidden when new one is opened. There is no limit to the amount of information you can add or sections you can use. Excellent for FAQs.


1] Example & Explanation:
Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam
2] Compatibility:
Epsum factorial non deposit quid pro quo hic escorol. Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum. Defacto lingo est igpay atinlay. Marquee selectus
3] Notes:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut

Notes

Each collapsible header has 2 DIV tags, one is the main header that opens or closes the collapsible text and the other is for the collapsible text or content. In the first DIV tag the text (onClick="openClose('a1')") should not be changed and in the second DIV tag the text (id="a1" class="texter") is required. As you add more collapsible headers the identifier 'a1' should be incremented for all new headers in both DIV tags, for example a2 for header 2, a3 for header 3 etc. Everything else can be modified as per your requirements.

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: collapsibleText.js


CSS

Paste this code into your external CSS file or in the <style> section within the HEAD section of your HTML document.


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


User Comments

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

    
   
       
[optional]
 
[optional]

   

Comments feed Comment Feed RSS 2.0

6. From: Eric
Awesome & Easy to customize
09/03/2008 17:07:16

I used it to hide a whole table of form fields that are optional, and used a checkbox with the onClick event. Worked great and code is so short. Great work.

5. From: J
Thank You!
01/31/2008 20:40:35

I was thrown a last minute project and was given code that was not usable. I came to this site looking for collapsible text and this was EXACTLY what I needed! Wished I came here earlier on as I had another project - given even crappier code - that required collapsible lists and this would have been perfect.

blk

3. From: Joe Pallaitn
JavaScript in Email
09/21/2007 15:26:31

The JavaScript in the sent email is not the same as on the site and does not work.

4. From: Lee (Admin)
11/06/2007 11:49:58

Not sure of the problem. It's all the same on this end.

2. From: Maryann Casas
Great script - thanks
09/16/2007 05:56:50

Been looking for something like this for a long time. Thanks. Will definitely use it in our FAQs page.

1. From: allen
applause
09/14/2007 15:02:18

Like your program and will incorporate into our website soon. thanks for your efforts


Do you write JavaScripts?
If you do, why not submit them to us?
We'll give you credit and a link back to your Web site.