jQuery .detach() method removes elements from DOM

Syntax and Description

.detach([selector])

Remove the set of matched elements from the DOM. selector (optional) is a selector expression that filters the set of matched elements to be removed. Its return value is the jQuery object, for chaining purposes. The removed elements are still referenced by this object, even though they are no longer in the DOM.

This method is useful when removed elements are to be reinserted into the DOM at a later time.





















Home »
  jQuery »
    jQuery Tutorial »




Basics
Selector
DOM
Event
Effect
Utilities