Skip to content
Discussion options

You must be logged in to vote

hx-confirm is an inheritable attribute in htmx, any descendant that issues a request picks it up from the nearest ancestor that sets it, which is exactly why putting it on tbody applies it to every button underneath, including the Edit button you don't want confirmed. You don't need to repeat or restructure anything, htmx has a documented escape hatch for exactly this: set hx-confirm="unset" on the specific element you want to opt out, and inheritance stops there for that attribute.

<tbody hx-confirm="Are you sure?">
  <tr>
    <td>
      <button class="danger" hx-delete="/row/1">Delete</button>
      <button hx-confirm="unset" hx-get="/row/1/edit">Edit</button>
    </td>
  </tr>
</tbody>

T…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by senyai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants