index.html 965 B

123456789101112131415161718192021222324252627282930
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Checklist</title>
  7. <script>
  8. // Function to focus on the input field
  9. function focusInput() {
  10. document.getElementById('itemInput').focus();
  11. }
  12. </script>
  13. </head>
  14. <body onload="focusInput()">
  15. <h1>Checklist</h1>
  16. <form method="POST" onsubmit="focusInput()">
  17. <input type="text" id="itemInput" name="item" placeholder="Add a new item" required>
  18. <button type="submit">Add</button>
  19. </form>
  20. <ul>
  21. {% for item in items %}
  22. <li style="text-decoration: {{ 'line-through' if item.checked else 'none' }};">
  23. {{ item.name }}
  24. <a href="{{ url_for('check', item_id=loop.index0) }}">[Check]</a>
  25. </li>
  26. {% endfor %}
  27. </ul>
  28. <a href="{{ url_for('list') }}">View List</a>
  29. </body>
  30. </html>