Hi Matt,
Give this a shot:

$(document).ready( function(){
         $( '#menu ul' ).hide();
         $( '#menu li.' + $( 'body' ).attr( 'id' ) + ' ul' ).show();
});

Demo here: http://jsbin.com/ehape

Chuck Harmston
http://chuckharmston.com

On Sat, Apr 18, 2009 at 10:50 AM, Max <mackerma...@gmail.com> wrote:

>
> hi Im new to jquery and having some trouble adapting the code below.
> the function is for a accordion menu. I want it to recognize the
> body's id, and show the sub menu who's class matches the body id.
> right now it is set to show the submenu with class="test".
>
> function initMenu() {
>
> $('#menu ul').hide();
> $('#menu ul.test').show();
> $('#menu li a').click(
> function() {
> $(this).next().toggle();
> }
> );
> }
> $(document).ready(function() {initMenu();});
>
>
> do i start with something allong the lines of
> var bodyid = $("body").attr("id");
> ?
>
> Any suggestions greatly appreciated.
>
> Thanks
> -Max
>

Reply via email to