Answer the question
In order to leave comments, you need to log in
How to run a method inside a class?
There is such a class:
class Inputmask {
constructor(selector, patt, replaceable) {
this.selector = selector,
this.patt = patt,
this.replaceable = replaceable
}
iteration() {
let inputs = document.querySelectorAll(this.selector);
inputs.forEach(field => {
// тут обработчик
});
}
}
const maskedInput = new Inputmask('input[type="tel"]', '+7 (___) ___-__-__', '_');
maskedInput.iteration();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question