Question: what is the difference between $('#element').remove() and $('#element').detach()?
Answer: detach() removes the matched elements, including all text and child nodes. This method stores all the data associated with the element and so can be used to restore the element's data as well as event handlers. remove() also removes the matched elements, including all text and child nodes.