diff --git a/public/script.js b/public/script.js index b4185c8..d267d37 100644 --- a/public/script.js +++ b/public/script.js @@ -239,6 +239,19 @@ function displayErrorWithTips(errorMessage, container) { container.innerHTML = errorMessage + tipsHTML; } +// =================================== +// AUTO-TRIM INPUT FIELDS +// =================================== +// Automatically trim whitespace from all text inputs on blur +document.addEventListener('DOMContentLoaded', () => { + const textInputs = document.querySelectorAll('input[type="text"], input[type="email"], input[type="password"]'); + textInputs.forEach(input => { + input.addEventListener('blur', function() { + this.value = this.value.trim(); + }); + }); +}); + // =================================== // PASSWORD TOGGLE // ===================================