jQuery remove()Method
Examples
Remove all <p> elements:
$("button").click(function(){
$("p").remove();
});
Try it Yourself »
Definition and Usage
The remove() method removes the selected elements, including all text and child nodes.
This method also removes the selected element's data and events.
Tip:To remove the elements, but keep data and events, use thedetach()method instead.
Tip:If you only need to remove content from the selected elements, use theempty()method.
Syntax
$(selector).remove()
More Examples
Difference between detach() and remove()
Demonstrate the difference between the detach() and remove() methods.
Other Extensions
jQuery HTML/CSS Methods