On Jul 9, 2007, at 13:45 , Stephan Beal wrote:

How do i permanently remove items from the DOM *and* jQuery object? i
am aware of jQuery(..).remove(), but the docs for remove() say:

"This does NOT remove them from the jQuery object, allowing you to use
the matched elements further."

This "feature" [snide comment removed] causes me to have to jump
through some hoops in my code to set the matched DOM object IDs to
null so that i won't pick them up in later queries.

I think you're confused about what "the jQuery object" means here. There isn't a master internal list of objects that is keeping track of the DOM nodes. The docs are talking about the individual jQuery object instance you're working with, so you can have the code:

$('#myElement').remove().doSomethingElseWithMyElement();

The chain is not broken, and the object still has access to the element. It is removed from the DOM, though, so a later call to:

$('#myElement')

will match no elements. It will be an empty jQuery object.

--
Jonathan Chaffer
Technology Officer, Structure Interactive


Reply via email to