Custom Elements
Define your own HTML tags backed by JavaScript classes.
Advanced
class LedIndicator extends HTMLElement {
connectedCallback() { this.textContent = this.hasAttribute("on") ? "● ON" : "○ OFF"; }
}
customElements.define("led-indicator", LedIndicator);
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.