mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
15 lines
435 B
JavaScript
15 lines
435 B
JavaScript
(function () {
|
|
function trimTextFields() {
|
|
let selector = 'input[type=text], input[type=search], input[type=email], textarea';
|
|
let textFields = document.querySelectorAll(selector);
|
|
let listener = function () {
|
|
this.value = this.value.trim();
|
|
};
|
|
|
|
for (let field of textFields) {
|
|
field.addEventListener('change', listener);
|
|
}
|
|
}
|
|
|
|
trimTextFields();
|
|
})();
|