Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (37 sloc) 1.354 kB
<?xml version="1.0"?>
<entry type="method" name="detach" return="jQuery">
<argument name="selector" optional="true" type="Selector">
<desc>A selector expression that filters the set of matched elements to be removed.</desc>
<desc>Remove the set of matched elements from the DOM.</desc>
<p>The <code>.detach()</code> method is the same as <code><a href="/remove">.remove()</a></code>, except that <code>.detach()</code> keeps all jQuery data associated with the removed elements. This method is useful when removed elements are to be reinserted into the DOM at a later time.</p>
<desc>Detach all paragraphs from the DOM</desc>
var p;
if ( p ) {
p = null;
} else {
p = $("p").detach();
<css><![CDATA[p { background:yellow; margin:6px 0; } { background: black; }]]></css>
how are
<button>Attach/detach paragraphs</button>]]></html>
<category slug="manipulation/dom-removal"/>
<category slug="version/1.4"/>
Jump to Line
Something went wrong with that request. Please try again.