.detach() in jQuery

It helps to remove the set of matched elements from the DOM.

.detach()

// To remove all < p> elements.

$(“button”).click(function(){
    $(“p”).detach();
});