Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (17 sloc) 0.535 kb
title level source attribution
Detach Elements to Work with Them
intermediate
jQuery Fundamentals

The DOM is slow; you want to avoid manipulating it as much as possible. jQuery introduced $.fn.detach in version 1.4 to help address this issue, allowing you to remove an element from the DOM while you work with it.

var $table = $("#myTable");
var $parent = $table.parent();

$table.detach();

// ... add lots and lots of rows to table
$parent.append( $table );
Jump to Line
Something went wrong with that request. Please try again.