Here is the answer, thanks to digilover over at the SitePoint forums...
function initMenu() { $('#groups ul').hide(); $('#groups li a').click( function() { $(this).next().slideToggle('normal',function(){ var id = $(this).attr('id'); if ($(this).is(':hidden')) { var state = "closed"; } else if ($(this).is(':visible')) { var state = "open"; } alert($(this).attr('id') + ' is ' + state); return false; }); } ); }