jQuery detach () method
Definition and Usage
detach () method to remove the selected elements, including all text and child nodes. It will then retain the data and events.
This method will keep a copy of the removed elements, allowing them to be re-inserted later.
Tip: To remove the element and its data and events, use the remove () method instead.
Tip: If you need to remove content from the selected element, use empty () method.
grammar
$(selector).detach()
More examples
Remove and restore an element
How to use the detach () method to remove and restore an element.
Different detach () and remove () between
Between different methods of presentation detach () and remove ().