I'm using the cookie plugin. And, I have created 4 cookies with it and they are named:
Expanded[1]=3 Expanded[2]=18 Expanded[3]=27 Expanded[4]=37 I also keep a count of the number of cookies that have been created and the name of this cookie is this: onExpandCount=4 How do I loop through these cookies? I can't seem to get the syntax right. Here's what I've tried: function expandMenuUsingCookie() { for (var index=0;index<$.cookie('onExpandCount');index++) { //console.log(index); YAHOO.widget.TreeView.getNode('menu',$.cookie('Expanded['+index +']')).toggle(); } } There's something wrong with this line right about where I try to get the value of the cookie: YAHOO.widget.TreeView.getNode('menu',$.cookie('Expanded['+index +']')).toggle();