---
title: "Why are use the remove method in JQuery?"  
description: "Why are use the remove method in JQuery?"  
author: "Ethan Karla"  
published: 2021-07-28  
canonical: https://answers.mindstick.com/qa/93808/why-are-use-the-remove-method-in-jquery  
category: "web application"  
tags: ["web application development", "web development"]  
reading_time: 2 minutes  

---

# Why are use the remove method in JQuery?

Why are use the [remove](https://yourviews.mindstick.com/view/81420/this-is-no-time-to-remove-obamacare-for-usa-under-covid-19-pandemic) [method in JQuery](https://www.mindstick.com/forum/156670/has-method-in-jquery)?

## Answers

### Answer by Ravi Vishwakarma

The jQuery remove () [method](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business) is used to remove data and event of selected elements from html page. This remove () remove everything inside it (including all texts and child nodes) of selected elements.

```
Syntax
 $(selector).remove()
 $(selector).remove(“class selector, id selector, tag name selector, etc)
```

```
Example
<!DOCTYPE html>
<html>
<head>
    <script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
    <script>
        $(document).ready(function () {
            $('p').click(function () {
                $(this).remove();
            });
        });
    </script>
    <style>
        p {
            background-color:orange;
            color:white;
        }
    </style>
</head>
<body>
    <h1>Click any paragraph for remove from html page</h1>
    <p >MindStick pvt ltd in allahabad 1</p>
    <p >MindStick pvt ltd in allahabad 2</p>
    <p >MindStick pvt ltd in allahabad 3</p>
    <p >MindStick pvt ltd in allahabad 4</p>
    <p >MindStick pvt ltd in allahabad 5</p>
    <p >MindStick pvt ltd in allahabad 6</p>
    <p >MindStick pvt ltd in allahabad 7</p>
    <p >MindStick pvt ltd in allahabad 8</p>
</body>
</html>
```

![Why are use the remove method in JQuery?](https://answers.mindstick.com/questionanswer/dfd70b04-9138-40d6-adf3-daf9a7d2996e/images/fef5ac48-d06f-4a73-9f9f-b6522331219d.png)\


---

Original Source: https://answers.mindstick.com/qa/93808/why-are-use-the-remove-method-in-jquery

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
