This library is an {htmx_link} link:https://htmx.org/extensions[extension] that can be optionally used for situations in which you need to remove an element from the DOM that was originally added by {htmx_link} without making an HTTP request.
This library extension is most useful in situations in which you have clicked a link or triggered an htmx HTTP request which inserts a new DOM element such as form which has a cancel link/button. In these situations, you don't need to make an HTTP request to cancel/remove the newly added form. Instead, you only need to remove the original form.
toc::[]
== Features
Provides a convenient solution for canceling/removing DOM elements originally added by htmx without making additional HTTP requests.
Upon clicking the New link, the following element would be added to the DOM after {htmx_link} resolves the request:
[source,html]
Cancel
----
In this case, clicking the Cancel button would remove the entire form element from the DOM. This is made possible by first adding the hx-ext="remove" attribute to the form element and then adding the data-remove="true" attribute to the button element.
Behind the scenes, this extension will listen for click events for the first element with a data-remove="true" attribute. Once clicked, the corresponding element for which this extension is loaded and associated with (i.e. form) via the hx-ext="remove" attribute will be removed from the DOM.
That's it! A simple extension for dealing with DOM elements a user might want to cancel/remove because they decided adding something new wasn't necessary after all.
A htmx extension for DOM element removal via click events.
The npm package htmx-remove receives a total of 89 weekly downloads. As such, htmx-remove popularity was classified as not popular.
We found that htmx-remove demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Package last updated on 22 Mar 2025
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.