The jQuery object (returned by a $(...) query) is an "array-like" object. It
doesn't use a separate Array to store its data. The jQuery object itself has
a .length property, and numeric indices [0] through [.length-1]. And of
course it has all the other jQuery methods.

But it is not an Array and does not have any of the usual Array methods.

In addition to the methods in the Traversing page, you can manipulate this
array-like object directly if you want. Just keep in mind that, unlike an
Array, the .length property will not update itself. For example:

    var $foo = $('whatever');
    $foo[ $foo.length++ ] = someDomElement;

Note the difference between this object and an Array. With an Array object,
the .length property would update automatically and you would have coded:

    $foo[ $foo.length ] = someDomElement;

Or:

    $foo.push( someDomElement );

and either way the .length property would update. This doesn't happen with
the jQuery object because it is not an Array, merely an Object with certain
properties including .length and [0]...[n].

-Mike

For example, you can 

> > Check out the functions here, particularly under Filtering:
> > http://docs.jquery.com/Traversing
> 
> thx. i am aware of those methods but can't see how i can "add 
> this, delete that" element from a jQuery object using those. 
> i gather that underlyingly jQuery is using some sort of Array 
> object to manage its collections, so maybe it would be 
> easiest to manipulate that object.
> however, i can't find it in the source. does anyone have a 
> clue how to uncover it?
> 
> _wolf
> 

Reply via email to