I often will put stuff like report filters or control break groups inside fieldsets.
Its also nice to group related input fields. This snippet will automatically wire up event handlers to allow you to show and hide the contents of the fieldset when the user clicks on the legend.
$(document).ready(function () {
$('legend').click(function () {
var $this = $(this);
var parent = $this.parent();
var contents = parent.contents().not(this);
if (contents.length > 0) {
$this.data("contents", contents.remove());
} else {
$this.data("contents").appendTo(parent);
}
});
});
You can also easily collapse everything with this:
$('#data legend').click();
This will collapse all of the fieldsets in the div tag with an id of data