Ok, got it! $("[EMAIL PROTECTED]").show().parents("ul").show();
Duh! It reads so logical from left to right! That gives me the exact number of elements and show() events! With my real tree many list, its a major different in speed! -- HLS On Sep 7, 5:14 pm, Pops <[EMAIL PROTECTED]> wrote: > Ok, actually the real trick was in the selector. I still need the > first-child, but with your parents("ul") filter, it reduced the > redundancy: > > This worked: > > var $v = $("[EMAIL PROTECTED] :first-child").parents('ul'); > $v.show(); > > This didn't open the level only its parents: > > var $v = $("[EMAIL PROTECTED]").parents('ul'); > $v.show(); > > Example tree: > > <ul> > <li><a>Chapter 1</a> > <ul> > <li><a>Item 1.1</a></li> > <li><a>Sub-Chapter 1.2</a> > <ul> > <li><a>Sub-Chapter 1.1</a> > > <ul > > <li><a>Item 1.1.1</a></li> > <li><a>Item 1.1.2</a></li> > <li><a>Item 1.1.3</a></li> > </ul> > </li> > <li><a>Sub-Chapter 1.2</a> > > <ul state="1"> > <li><a>Item 1.2.1</a></li> > <li><a>Item 1.2.2</a></li> > <li><a>Item 1.2.3</a></li> > </ul> > </li> > <li><a>Sub-Chapter 1.3</a> > > <ul > > <li><a>Item 1.3.1</a></li> > <li><a>Item 1.3.2</a></li> > <li><a>Item 1.3.3</a></li> > </ul> > </li> > <li><a>Sub-Chapter 1.4</a> > > <ul > > <li><a>Item 1.4.1</a></li> > <li><a>Item 1.4.2</a></li> > <li><a>Item 1.4.3</a></li> > </ul> > </li> > </ul> > > </li> > <li><a>Item 1.3</a></li> > </ul> > </li> > </ul> > > --- > HLS > > On Sep 7, 4:49 pm, Pops <[EMAIL PROTECTED]> wrote: > > > That worked! Perfect! Thanks! > > > I did get an idiom to work but it was returning too many recursive > > elements: > > > var $v = $("[EMAIL PROTECTED] :first-child").parents(); > > $v.show(); > > > I knew there had to be something better. I did try parent and parents > > but I guess I didn't understand that .parents(filter) will continue to > > propapate upward! That's perfect! > > > Thanks again > > > -- > > HLS > > > On Sep 7, 4:10 pm, "Glen Lipka" <[EMAIL PROTECTED]> wrote: > > > > How about this? (in the open function) > > > $(this).parents("ul").show(); > > > > Glen > > > > On 9/7/07, Pops <[EMAIL PROTECTED]> wrote: > > > > > I have a tree list and when I toggle a deep item to expand/show, I > > > > want all its parents to expand as well. What selector or method will > > > > give me this? > > > > > I guess this is expanding the sub-tree which I can do natively, but > > > > would like to do it via jQuery. > > > > > TIA > > > > > -- > > > > HLS