I wrote a standalone jQuery function to do this:
$.fn.fieldsetSlideToggle = function (speed) {
var $this = $(this),
$inner = $this.children().eq(0),
display = $this.css('display'),
slideSpeed = speed ? speed : 'fast';
// 1. Check if first child of fieldset is <div>
// 2. Wrap contents in <div> if not
if (!$inner.is("div")) {
$inner = $('<div />').html($this.html());
$this.empty().append($inner);
}
// 3. SlideToggle on div
if (display == 'none') {
$this.show();
$inner.hide().slideDown(slideSpeed, function () {
$this.html($inner.html());
});
} else {
$inner.slideUp(slideSpeed, function () {
$this.html($inner.html()).hide();
});
}
}
Fiddle: http://jsfiddle.net/tbDRu/6/. Click on the button to slideup/down the fieldset.