JavaScript Custom Elements

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • .prototype.createdCallback()
  • .prototype.attachedCallback()
  • .prototype.detachedCallback()
  • .prototype.attributeChangedCallback(name, oldValue, newValue)
  • document.registerElement(name, [options])

Parameters

ParameterDetails
nameThe name of the new custom element.
options.extendsThe name of the native element being extended, if any.
options.prototypeThe custom prototype to use for the custom element, if any.

Remarks

Note that the Custom Elements specification has not yet been standardized, and is subject to change. The documentation describes the version that's been shipped in Chrome stable at this time.

Custom Elements is an HTML5 feature allowing developers to use JavaScript to define custom HTML tags that can be used in their pages, with associated styles and behaviours. They are often used with .



Got any JavaScript Question?