> I have the need of removing list items from List A and
> then adding them to List B. I'm using the .remove()
> function to remove the elements from the DOM. The API
> says very urgently that the remove() method doesn't
> remove the items from the jQuery object, so that I can
> use them later. 
> How exactly do I go about "using them later"?

I think something like this:

$("#listA").find(".chosen").remove().appendTo("#listB"); 

If you are targeting just one node as the example above, the remove()  isn't
needed because the standard DOM appendChild behavior will remove the node
from its old location before putting it in the new location. However,
consider this example:

$("#stove").find(".lumpsOfCoal").remove().appendTo(".stockings");

If you append to multiple targets (e.g., ".stockings" selects multiple
elements) , the original elements are cloned before being appended to each
target so the original elements would stay in their old place unless you
remove()d them. If you're _not sure_ whether .stockings is going to select
multiple nodes, you should use remove() to make sure the .lumpsOfCoal are
removed from the #stove.



_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to