Sure enough! Note to self...make sure that html is valid before messing with the DOM. All kidding aside, using a ul without being in a li is something I have done many times before. The difference here is using javascript to mess with the DOM. I am new to javascript.
Thanks a bunch. On Nov 30, 12:03 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > It isn't possible to have an LI sibing right before a UL. > That would mean markup like this: > > <ul> > <li>List Item #1</li> <-- LI Sibling > <ul> <-- UL > <li>List Item #2</li> > <li>List Item #3</li> > </ul> > </ul> > > That is illegal markup. > > Your markup actually looks like this: > > <h1>Get to know Trinity</h1> <-- H1 sibling > <ul> <-- UL > <li> > <a href="...">About Us</a> <-- A sibling > <ul> <-- UL > <li><a href="...">History</a></li> > .... > > These are the elements you are getting with a $('ul').prev() > > There ARE no LI siblings just before a UL. > > So which elements are you actually trying to get? > JK > > -----Original Message----- > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > Behalf Of flycast > Sent: Sunday, November 30, 2008 8:42 AM > To: jQuery (English) > Subject: [jQuery] Re: Problem with prev() in IE > > No. I am definitely looking for the <li> sibling right before any > <ul>...</ul>. I am building menus and submenus. Any <ul>...<ul> that > appears below a <li>...</li> is a submenu. I know that I could add a > "name" or class to either the head or subhead. I wouod rather have > jQuery find these so that I don't have any markup in the HTML > necessary to make this work. > > On Nov 29, 11:21 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > > Okay, so I stepped through the code. I'm going to hazard a guess that you > > didn't want the previous element but the parent element. > > > $('#LHNav ul').prev() returns an H1 and an array of A elements. > > > This is because prev looks for the sibling element just in front of the > > current one. > > > $('#LHNav ul').parent('li') will, I believe, return the results you are > > looking for. > > > JK > > > P.S. IMO, the really odd thing is why FF worked when I believe it should > > have returned an empty set. Anyone else have any ideas? > > > -----Original Message----- > > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > > Behalf Of flycast > > Sent: Saturday, November 29, 2008 8:29 PM > > To: jQuery (English) > > Subject: [jQuery] Re: Problem with prev() in IE > > > Yes...http://www.trinityacademy.org/testNavigation/ > > > On Nov 29, 6:22 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > > > I've used something very similar to that in IE6 without any problems. > > > > Could you post a demo page? > > > > JK > > > > -----Original Message----- > > > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > > > Behalf Of flycast > > > Sent: Saturday, November 29, 2008 3:57 PM > > > To: jQuery (English) > > > Subject: [jQuery] Problem with prev() in IE > > > > This code works fine in FF and Safari but (surprise, surprise) not in > > > IE6. > > > > $("#LHNav ul").prev('li').each(function(){ > > > alert("Loop"); > > > }); > > > > I have narrowed it down to giving prev() some value to filter by. IF I > > > try it like this: > > > (notice the missing "li") > > > > $("#LHNav ul").prev().each(function(){ > > > alert("Loop"); > > > }); > > > > It works fine. Why does IE always have to be so buggy and particular?