This seems like a possible work-around:
var foo = $('#foo').clone(true);
$('#foo').remove();
foo.appendTo('somewhere else later')
Not removing the handlers and data would consume more memory I guess,
there is no way to guess if it's gonna be reappended or not.
On Jan 29, 7:54 am, Már Örlygsson <[email protected]> wrote:
> `$("#foo").remove()` removes all event handlers and stored data.
>
> But, sometimes I'd like to temporarily remove an element from the DOM
> for later reinjection, in which case the event and data removal
> becomes a nuisance.
>
> Is there a way to do that in jQuery - aside from writing your own
> `.removeTemp()` plugin?
>
> `$("#foo").remove(true)`
> `$("#foo").remove(selector, true)`
>
> feels like a natural way to express this.
>
> any thoughts?
>
> --
> Már Örlygsson
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---