jQuery remove() Method

jQuery remove() method removes the selected elements as well as everything inside it.

Use the empty() method to remove only the content from the selected elements.


Here is a syntax for the remove() method

$(selector).remove( selector );
Parameter Type Description
selector Selector Optional. A selector expression that filter the matched elements to be removed.


Here, in this example remove() method call on selected elements when click on button.

<!DOCTYPE html>
  <title>jQuery remove() method</title>
  <script src="jquery-latest.min.js"></script>
    <p>First paragraph start here...</p>
  <button>Click here to call remove() method</button>

Run it...   »