mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
Previously `let of` loop was used, which isn't supported in IE11. It seems it just fails when there is some JS syntax error (doesn't matter where exactly) and dataType: 'json' has no effect. Closes #982
17 lines
508 B
JavaScript
17 lines
508 B
JavaScript
(function () {
|
|
function trimTextFields() {
|
|
let selector = 'input[type=text], input[type=search], input[type=email], textarea';
|
|
let textFields = document.querySelectorAll(selector);
|
|
let changeListener = function () {
|
|
this.value = this.value.trim();
|
|
};
|
|
|
|
textFields.forEach(
|
|
function (field, currentIndex, listObj) {
|
|
field.addEventListener('change', changeListener);
|
|
}
|
|
);
|
|
}
|
|
|
|
trimTextFields();
|
|
})();
|