Код: Выделить всё
class Form extends HTMLElement {
constructor() {
super()
}
connectedCallback() {
console.log(this)
console.log(this.innerHTML)
}
}
customElements.define("my-form", Form);
Код: Выделить всё
class Form extends HTMLElement {
constructor() {
super()
}
connectedCallback() {
let inputCounter = 0
for (let i of this.querySelectorAll("input")) {
this[inputCounter] = i
inputCounter++
}
}
}
customElements.define("my-form", Form);
Подробнее здесь: https://stackoverflow.com/questions/709 ... edcallback
Мобильная версия