Thanks so much for the reply. however i may have worded my question poorly.
I need the if statement to replace $('#menu ul.test').show(); so that instead the <ul> with class test, only the ul with the class matching the body is shown. the rest are hidden. thanks again -Max On Apr 18, 6:50 pm, Nic Hubbard <nnhubb...@gmail.com> wrote: > 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!