I have the following now function initMenu() { if ($.cookie('the_cookie')=='2') //comes here after refresh!! {
alert('came here'); $("a").filter(".b").slideDown('normal'); //but this seems to be not working!! alert('did the sliding: ' + $("a").filter(".b").attr('name')); } $('#menu ul').hide(); $('#menu li a').click( function() { $(this).filter(".b").click(function(){setCookie($ (this).attr('name'));}); alert('this isname: ' + $(this).attr('name')); $(this).next().slideDown('normal'); } ); } function setCookie(some) { $.cookie('the_cookie', some); alert('cookie set ' + some); } $(document).ready(function() {initMenu();}); On Jan 28, 5:29 pm, Bhaarat Sharma <[EMAIL PROTECTED]> wrote: > thanks that woked! > > i am getting very confused as i have no prior experience with > javascript either. > > Can you please see If im going in right direction with this? > > I am just trying to take this > pluginhttp://www.i-marco.nl/weblog/jquery-accordion-menu/ > and integrate cookies to it so once user hits refresh his settings > stay in place > > this is what I have so far. > > function initMenu() { > $('#menu ul').hide(); > $('#menu li a').click( > function() { > $(this).filter(".a").click(function(){setCookie($(this));}); > alert('this isname: ' + $(this).attr('name')); > > $(this).next().slideToggle('normal'); > > } > ); > } > function setCookie(ob) > { > $.cookie('the_cookie', 'the_value'); > alert('cookie set ' + $ob.attr('name')); > } > $(document).ready(function() {initMenu();}); > > but in my setCookie method I'm not able to get the value of the > attribute... > > On Jan 28, 5:09 pm, "Matt Quackenbush" <[EMAIL PROTECTED]> wrote: > > > $(this).attr('name'); > > > I think that's what you're looking for?