JavaScript
Result
Run
License
class MyElement extends HTMLElement { constructor() { super(); } } document.addEventListener("DOMContentLoaded", () => { window.customElements.define("my-element", MyElement); const $elMy = document.createElement("my-element"); $elMy.textContent = "Click me"; document.body.append($elMy); $elMy.addEventListener("click", e => { e.currentTarget.style.color = "red"; }); });
Console
expand_less
License
License
by DevDic
Close