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?