<my-custom></my-custom>
<script>
class MyWebComponent extends HTMLElement {
constructor() {
super();
this.innerHTML = `<h1>Hello World</h1>`;
this.header = this.querySelector('h1');
}
changeTextColor(color) {
this.header.style.color = color;
}
changeText(text) {
this.header.innerText = text;
}
}
customElements.define('my-custom', MyWebComponent);
</script>