class PHONE {
constructor(input, number) {
(this.inputPhone = input), (this.number = number);
this.clickButton = this.clickButton.bind(this);
}
value(keyboardKey) {
this.inputPhone.value += keyboardKey;
}
clickButton() {
for (let i = 0; i < this.number.length; i++) {
const element = this.number[i];
element.onclick = () => {
this.value(element.value);
element.classList.add('ativa')
setTimeout(() => {
element.classList.remove('ativa')
}, 200)
};
}
}
}
const phoneAlura = new PHONE(
document.querySelector("input[type=tel]"),
document.querySelectorAll("input[type=button]")
);
phoneAlura.clickButton();
Caso tiver alguma dica, só mandar!