Aaron: That's correct and it can be extremely useful in DOM manipulation if you need to build unique strings based on the object (say, ids).
-- Yehuda On 1/4/07, Aaron Heimlich <[EMAIL PROTECTED]> wrote:
I just took a look at the code for $.each and noticed that is passes two arguments to the callback, the name/index of the current item and the item itself (in that order). Test page: http://aheimlich.freepgs.com/tests/jquery/each-test/ On 1/4/07, Michael Geary <[EMAIL PROTECTED]> wrote: > > > > Andreas, if I remember correctly, the following should work: > > > > > > $.each(object, function() { > > > > > > return false; > > > }); > > > That isn't supported. The necessary code was removed due to > > unsolved problems. Actually the stuff that Michael just > > posted would help a lot to solve it, though I'm not sure if > > it is even possible, due to the Function.apply usage. > > The code I posted does solve this problem completely - simply use > objectEach > instead of $.each, and change your callback function to take explicit > parameters instead of using "this". > > Using "this" in an object iterator doesn't make much sense anyway. You > need > two arguments (name and value) regardless, and the code is much more > understandable when they are both named parameters. > > $.each should be regarded as a jQuery internal function only - there's > no > reason to use it when it's so easy to write your own, more > straightforward > iterator. > > -Mike > > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
-- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325
_______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/