Skip to content

Instantly share code, notes, and snippets.

@trey
Last active August 27, 2024 09:33
Show Gist options
  • Save trey/d04adbcc234800e90ff2ea3db3adcb46 to your computer and use it in GitHub Desktop.
Save trey/d04adbcc234800e90ff2ea3db3adcb46 to your computer and use it in GitHub Desktop.

Revisions

  1. trey revised this gist Dec 18, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion alpine.html
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,6 @@
    https://github.com/alpinejs/alpine/issues/150#issuecomment-580452229
    -->

    <form x-data action="/something" @submit.prevent="if (confirm('Are you sure?')) { $el.submit() }" method="post">
    <form x-data action="/something" @submit.prevent="if (confirm('Are you sure?')) $el.submit()" method="post">
    <button aria-label="Delete this">[some icon]</button>
    </form>
  2. trey revised this gist Dec 18, 2021. 2 changed files with 2 additions and 0 deletions.
    1 change: 1 addition & 0 deletions alpine.html
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    <!--
    https://alpinejs.dev/directives/on#prevent
    https://github.com/alpinejs/alpine/issues/150#issuecomment-580452229
    -->

    <form x-data action="/something" @submit.prevent="if (confirm('Are you sure?')) { $el.submit() }" method="post">
    1 change: 1 addition & 0 deletions htmx.html
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    <!--
    https://htmx.org/attributes/hx-confirm/
    https://htmx.org/attributes/hx-delete/
    -->

    <form action="/something" hx-confirm="Are you sure?" method="post">
  3. trey revised this gist Dec 18, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion htmx.html
    Original file line number Diff line number Diff line change
    @@ -3,5 +3,5 @@
    -->

    <form action="/something" hx-confirm="Are you sure?" method="post">
    <button hx-delete="something" aria-label="Delete this">[some icon]</button>
    <button hx-delete="/something" aria-label="Delete this">[some icon]</button>
    </form>
  4. trey revised this gist Dec 18, 2021. 2 changed files with 11 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions confirmation.html → alpine.html
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    <!--
    https://alpinejs.dev/directives/on#prevent
    -->

    <form x-data action="/something" @submit.prevent="if (confirm('Are you sure?')) { $el.submit() }" method="post">
    <button aria-label="Delete this">[some icon]</button>
    </form>
    7 changes: 7 additions & 0 deletions htmx.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    <!--
    https://htmx.org/attributes/hx-confirm/
    -->

    <form action="/something" hx-confirm="Are you sure?" method="post">
    <button hx-delete="something" aria-label="Delete this">[some icon]</button>
    </form>
  5. trey created this gist Dec 18, 2021.
    3 changes: 3 additions & 0 deletions confirmation.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    <form x-data action="/something" @submit.prevent="if (confirm('Are you sure?')) { $el.submit() }" method="post">
    <button aria-label="Delete this">[some icon]</button>
    </form>