feat: auto-trim whitespace from text inputs on form submit globally

This commit is contained in:
2026-07-06 20:10:54 +08:00
parent a0e7f46cc5
commit 200602c1e6

View File

@@ -26,4 +26,12 @@
{% block content %}{% endblock %}
</main>
</body>
<script>
// Auto-trim whitespace from all text inputs and textareas on form submit
document.addEventListener('submit', function(e) {
e.target.querySelectorAll('input[type="text"], textarea').forEach(function(el) {
el.value = el.value.trim();
});
}, true);
</script>
</html>