Instructor: In order to create a custom element, we need to create a class. Inside our HDML file, we'll create a script tag. Inside we'll define a class. We'll call it, "My custom element." We'll make sure it extends HTML element. Inside its constructor, we'll call the super method, which makes sure we inherit everything from HTML element.
We'll define the click event and set up a call-back that fires an alert. Now we can define a connected call-back, which fires when the custom element is connected to the dome. Here, it is safe to do dome manipulations like inner HTML. This is a good place to set up our custom elements template.
The second thing we need to do is to define the custom elements, so window.customelements.define. We pass the custom tag name and the class we've just created. The final thing we need to do is to actually use the tag inside our dome. We set it up, refresh the page, and here is our custom element. We click it and we see that our click is registered.
This is how we create a custom element.