mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 11:38:30 +02:00
Support IE11
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
This commit is contained in:
parent
8666f4f714
commit
02f9e99428
6 changed files with 35 additions and 8 deletions
|
@ -2,13 +2,15 @@
|
|||
function trimTextFields() {
|
||||
let selector = 'input[type=text], input[type=search], input[type=email], textarea';
|
||||
let textFields = document.querySelectorAll(selector);
|
||||
let listener = function () {
|
||||
let changeListener = function () {
|
||||
this.value = this.value.trim();
|
||||
};
|
||||
|
||||
for (let field of textFields) {
|
||||
field.addEventListener('change', listener);
|
||||
}
|
||||
textFields.forEach(
|
||||
function (field, currentIndex, listObj) {
|
||||
field.addEventListener('change', changeListener);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
trimTextFields();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue