> Is there any way to reset JQuery collection.
If the DOM tree has changed, you can just requery using the same expression
to get an updated view.
> For example I do this: $('.boxes').size(), returned 3
> Then I do this: $('.boxes:visible').remove(); Let's
> assume there were 2 visible boxes. So logically I'd
> expect JQuery to return 1 when I do this again:
> '.boxes').size(), but it is still returning 3.
The .remove() takes them out of the DOM tree but not out of your collection.
The docs at visualjquery.com for remove() say this: "Removes only elements
(out of the list of matched elements) that match the specified jQuery
expression. This does NOT remove them from the jQuery object, allowing you
to use the matched elements further."
The reason it works that way is that you might want to take the elements out
of the document using remove(), change them a bit, and reinsert them at a
different point.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/