> $('#orderform').find('.options').hide(); > $('.product-type').find('option.producta').click(function(select) { > $('fieldset.producta').slideDown("slow"); > }); > $('.product-type').find('option.productb').click(function(select) { > $('fieldset.productb').slideDown("slow"); > });
Maybe something like this? $('.product-type').bind("change", function() { var $newfields = $("#orderform fieldset."+ (this.className||'none')); var $oldfields = $('#orderform fieldset:visible'); if ( $oldfields.length ) $oldfields.slideUp("slow", function() { $newfields.slideDown("slow"); }); else $newfields.slideDown("slow"); });