Feat: Auto-trim whitespace from input fields on blur

This commit is contained in:
2025-12-27 20:40:14 +11:00
parent 158d774731
commit a0a903009d

View File

@@ -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
// ===================================