feat: auto-trim whitespace from text inputs on form submit globally
This commit is contained in:
@@ -26,4 +26,12 @@
|
|||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</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>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user