Easy Tutorial
❮ Misc Noop Misc Deferred Done ❯

jQuery remove() Method

jQuery HTML/CSS Methods

Example

Remove all <p> elements:

$("button").click(function(){
    $("p").remove();
});

Definition and Usage

The remove() method removes the selected elements, including all text and child nodes.

This method also removes the data and events of the selected elements.

Tip: To remove elements but keep data and events, use the detach() method instead.

Tip: To remove only the content from the selected elements, use the empty() method.


Syntax


More Examples

Difference between detach() and remove()


jQuery HTML/CSS Methods

❮ Misc Noop Misc Deferred Done ❯