domCollapse is a Javascript that enables you to have collapsible elements in an HTML document. The collapsing and expanding of the elements is done using the DOM. The script is very simple to use, and degrades nicely in browsers that do not support the DOM. A demo is available online. Some non-technical people reading this have made use of domCollapse without even realizing it.
In terms of user interface considerations, it helps to keep a single webpage from getting too unwieldy and unreadable especially if it extends for 50 or hundred paragraphs. The idea is that rather than showing the entire article or document by default, it can be collapsed to show only the major headings of the document and this in my opinion actually makes  the overall purpose of the document clear to the reader.