Klaus Hartl wrote:
With the latest svn version, you can do this:
var $jQ = $("div");
for(var i=0; i < $jQ.length; i++) {
alert(i + ':' + $jQ[i]);
}
/c
> Hi all,
>
> does jQuery have a method to transform its results to an array of DOM
> nodes? Like for example:
>
> var lis = $('li').toArray();
>
> I need to gather some <li> elements and resort them based on an expando
> property or a class name.
>
> If not I can only go the way with each and create my own array, right?
>
> var lis = [];
> $('li').each(function() {
> lis.push(this);
> });
>
>
> -- Klaus
>
>
>
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/