[jQuery] Re: help - compare 3 lists, get the largest number of items...

2007-10-24 Thread rolfsf
I think I led you astray... I had been reading about slice() in the 1.2 docs, and assumed it was the same Karl Swedberg-2 wrote: > > oh, of course! sorry about that. The slice() method here isn't > actually a jQuery method. It's acting on an array instead. So, scrap > the .filter('last'

[jQuery] Re: help - compare 3 lists, get the largest number of items...

2007-10-24 Thread Karl Swedberg
oh, of course! sorry about that. The slice() method here isn't actually a jQuery method. It's acting on an array instead. So, scrap the .filter('last') and return to using .slice(-1). Doesn't matter what version of jQuery you're using, because it's actually a native JavaScript method in thi

[jQuery] Re: help - compare 3 lists, get the largest number of items...

2007-10-24 Thread rolfsf
errrm... thanks Karl... but I get: ":last" is not a function obviously, I'm not piecing this together quite right: var arr = new Array(2) arr[0] = $('ul#list1').size() arr[1] = $('ul#list2').size() arr[2] = $('ul#list3').

[jQuery] Re: help - compare 3 lists, get the largest number of items...

2007-10-24 Thread Karl Swedberg
Hi Rolfsf, Instead of .slice(-1), you can use .filter(':last') --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 24, 2007, at 3:53 PM, rolfsf wrote: Thanks Josh & Andy! I may not be able to upgrade to jQuery 1.2 right away - what's my alternative

[jQuery] Re: help - compare 3 lists, get the largest number of items...

2007-10-24 Thread rolfsf
Thanks Josh & Andy! I may not be able to upgrade to jQuery 1.2 right away - what's my alternative for slice()? r. Andy Matthews-4 wrote: > > > This will give you the highest val without having to loop over the array: > > var arr = new Array(6) > arr[0] = "10" > arr[1] = "5" > arr[2] = "40"

[jQuery] Re: help - compare 3 lists, get the largest number of items...

2007-10-24 Thread Andy Matthews
unction(a,b){return a - b}).slice(-1) -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Josh Nathanson Sent: Wednesday, October 24, 2007 1:36 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: help - compare 3 lists, get the largest number of i

[jQuery] Re: help - compare 3 lists, get the largest number of items...

2007-10-24 Thread Josh Nathanson
You will want $("#myList").size(). Create an array with the three sizes - like var mylistsizes = [ 3, 9, 7 ]. Then, loop over the array and set a variable to the current value. On each iteration, if the current iteration is greater than the held variable, reset the variable to the current it