Expand/Collapse Widget Examples

Widget 1: Basic Example

This is the content that will be shown or hidden when the header is clicked. It can contain any HTML elements you need.

Widget 2: Another Example

Here is some more text for the second example. You can have multiple widgets on the same page, each functioning independently.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Widget 3: With More Complex Content

A Subheading

This widget demonstrates that the controlled content can be quite complex.


function greet(name) {
  console.log("Hello, " + name + "!");
}
greet("World");