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 47a9c6a7ad
commit 0f01cc263d
1 file changed
+8
+8
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>