From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Glen Lipka Sent: Wednesday, November 29, 2006 9:52 AM To: jQuery Discussion. Subject: Re: [jQuery] Checkbox: Selecting all Previous
QUESTION OR FEATURE SUGGESTION arrayPos() would return the index of the array. So if I had 4 links with a class of "foo" and I clicked the third one, $arrayPos(".foo", this) would return 3 (or 2 if it started at zero). Maybe I should put this in a seperate message? Glen ------ Actually I was looking over the suggestion I made earlier, and noticed that I didn't need to figure out the array position like I had. Here's the modified code. $("[EMAIL PROTECTED]").each(function (i) { $(this).bind("click",function () { $(this).siblings("[EMAIL PROTECTED]").lt(i).each(function () { $(this).attr({checked: 'true'}); } ) } >From the API docs: 'Additionally, the (each) function, when executed, is >passed a single argument representing the position of the element in the >matched set.' That's all we want, so by including the 'i' we remove the need for the id or any other attribute to discern where the object is in the array. Again, tested in FF2/Win only. I can see where arrayPos would be a good function tho, just not necessary in this case. -ALEX _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/