function initMenu() { if ($('body').attr('id') === $('#menu ul').attr('class')) { $('#menu ul').hide(); $('#menu ul.test').show(); $('#menu li a').click( function() { $(this).next().toggle(); } ); } }
$(document).ready(function() {initMenu();}); On Apr 18, 7:54 am, Max <mackerma...@gmail.com> wrote: > Hi im trying to adapt the following function so that if the ul class > matches the body's id it will show. Right now it is set to show the > ul with the class 'test'. > > This is for an accordion menu, and would allow the same menu to be an > include on all pages. and the appropriate segment would open. > > function initMenu() { > > $('#menu ul').hide(); > $('#menu ul.test').show(); > $('#menu li a').click( > function() { > $(this).next().toggle(); > } > ); > } > $(document).ready(function() {initMenu();}); > > any suggestions? > Thanks!