This method is used to remove the selected elements( i.e all text and child nodes as well ). If we want to reinsert that removed elements , we can do that easily because it keeps a copy of the removed elements.
Syntax :
$(selector).detach()
HTML Code :
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>This is first line.</p>
<p>This is second line.</p>
<button>Remove all p elements</button>
</body>
</html>
0 Comment(s)