.remove()
methodThe .remove()
method in jQuery is used to remove all matched elements from DOM. This method also remove the jQuery data associated with the remove elements, like event hanlders,attached data.
.remove()
method Syntax.remove()
.remove()
method ExampleRemove all paragraphs from the DOM.
HTML
<div class="container"> <p>Learn JavaScript</p> <p>Learn jQuery</p> Lautturi tutorial </div>
jQuery
$("p").remove();
Result
<div class="container"> Lautturi tutorial </div>