[jQuery] Re: Breadcumb, error in for-loop

2009-09-26 Thread Geir
Thanks for helping out Althalos, but BrCu really gives me what I want. You see, for each parents('li') jQuery finds a:first, giving me the array I want. However, I wonder if the format of the array doesn't convert to insert as html..

[jQuery] Re: Breadcumb, error in for-loop

2009-09-26 Thread Geir
Success!!! var BrCu = here.parents('li').find("a:first"); var BText = ""; for (i=3; i>=0; i--){ if (BrCu[i] != undefined){ BText = BText + ' > ' + '' + BrCu.eq (i).html() + ''; }} $('#breadcumb span.ins').html(BText); Thank you for your hel

[jQuery] Re: Breadcumb, error in for-loop

2009-09-26 Thread Geir
Thanks! Now we're getting somewhere. (It's my first time writing a fo-expression) You're right about the comparison. It should be: for (i=3; i>=0; i--) > You're not initializing BText. I think this is valid.. http://www.w3schools.com/JS/js_variables.asp It's now writing to the page :)) Howeve

[jQuery] Re: Breadcumb, error in for-loop

2009-09-26 Thread Mike McNally
You're not initializing BText. Also, the comparison part of your "for" loop is wrong: should be "i == 0", not "i=0". On Sat, Sep 26, 2009 at 10:36 AM, Geir wrote: > > Ok, saw one mistake, overwriting the text on each for. > > So, tried this: >        var BrCu = here.parents('li').find("a:first"

[jQuery] Re: Breadcumb, error in for-loop

2009-09-26 Thread Geir
Ok, saw one mistake, overwriting the text on each for. So, tried this: var BrCu = here.parents('li').find("a:first"); var BText; for (i=3; i=0; i--){ if (BrCU[i] != undefined){ BText = BText + '> ' + BrCu[i]; }} $('#breadcumb span.ins').html

[jQuery] Re: Breadcumb, error in for-loop

2009-09-26 Thread Althalos
I'm not an expert either, so I may be wrong. But I doubt that BrCU really gives you what you want. find("a:first") will give you ONE element by definition... it will not return an array of elements. I think. Probably you need to do something like this: var el = ""; var BrCu = here.parents('li'); B

[jQuery] Re: Breadcumb, error in for-loop

2009-09-26 Thread Geir
Ok, understand the "undefined"-writing..