# How to add Delete Functionality Inside a Modal

> Please note that this is now available as a plugin for easier installation. While you can use this document as a reference, the recommended method to add…

Source: https://tadabase.com/docs/snippets/how-to-add-delete-functionality-inside-a-modal  
Status: Not yet re-checked. Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

> **Warning:** Please note that this is now available as a plugin for easier installation. While you can use this document as a reference, the recommended method to add this functionality is through the plugin installation wizard. Learn more about plugins [here](https://tadabase.com/docs).

![Screenshot for “How to add Delete Functionality Inside a Modal”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665166559723.png)

Here’s a way to add the delete functionality inside an edit popup modal.

**Step 1**

**Create a table with an “Edit” link.**

![Screenshot for “How to add Delete Functionality Inside a Modal”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665162004598.png)

**Step 2**

**Add a custom component to the edit page.**

![Screenshot for “How to add Delete Functionality Inside a Modal”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665165413991.png)

**Step 3**

**Add custom code to the template and JavaScript.**

**Template**

```
{{#each records}}

    </br>

    <p style="display:none;" id="id">{{id}}</p>

    <button class="btn btn-danger pull-left" id="delete"> Delete Record </button>

{{/each}}
```

![Screenshot for “How to add Delete Functionality Inside a Modal”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665165743358.png)

**JavaScript**

```
document.getElementById("delete").onclick = async function() {
    if (confirm("Are you sure you want to delete this session")) {
        var i = document.getElementById("id").innerText
        await deleteRecord("4YZjnDNPvl", i); // In this part add your delete function
        location.reload();

    }
};
```

![Screenshot for “How to add Delete Functionality Inside a Modal”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665165847392.png)

**Original Community Post:**

[How to add Delete Functionality inside a modal! - Community Discussions / Tips and Tricks - Tadabase Community](https://community.tadabase.io/t/how-to-add-delete-functionality-inside-a-modal/1515)
