detach() in jQuery
This method removes the set of matched elements from the DOM.
It removes all the text and child nodes of the specified element.
It keeps all the jQuery data related to the removed elements, so that it can be reinserted into the DOM at a later time if needed.
Syntax
$(selector).detach([selector])