Skip to content

Instantly share code, notes, and snippets.

@dharmatech
Created January 19, 2025 23:56
Show Gist options
  • Save dharmatech/04ba977296bf1c0254f0bb4a3e41c6cc to your computer and use it in GitHub Desktop.
Save dharmatech/04ba977296bf1c0254f0bb4a3e41c6cc to your computer and use it in GitHub Desktop.
<!doctype html>
<html lang="">
<head>
{# <script src="/static/js/htmx-1.8.0.js"></script> #}
<script src="https://unpkg.com/[email protected]/dist/htmx.min.js"></script>
</head>
<body>
<main>
<form x-data="{ selected: [] }">
<table>
<thead>
<tr>
<th></th> <th>First</th> <th>Last</th> <th>Phone</th> <th>Email</th> <th></th>
</tr>
</thead>
<tbody>
{% for contact in contacts %}
<tr>
<td><input type="checkbox" name="selected_contact_ids" value="{{ contact.id }}" x-model="selected"></td>
<td>{{ contact.first }}</td>
<td>{{ contact.last }}</td>
<td>{{ contact.phone }}</td>
<td>{{ contact.email }}</td>
<td>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button hx-delete="/contacts" hx-confirm="Confirm deletion" hx-target="body">
Delete Selected Contacts
</button>
</form>
</main>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment