HTML onslotchange Event Attribute
Description
The onslotchange event attribute runs a script when the nodes assigned to a <slot> element change, that is, when elements are added to or removed from the light DOM of a web component, or their slot attribute changes, so that different content is shown in the slot.
It is used inside the shadow root of a custom element. In the handler, event.target.assignedNodes() or assignedElements() returns the new content. It does not fire when the children of a slotted element change, only when the set of slotted nodes changes. The event bubbles, but it does not cross the shadow boundary.
Syntax
<slot onslotchange="script">
Values
- scriptThe name of the script to use when the event has been triggered.
Example
Browser Support
The following information will show you the current browser support for the HTML onslotchange event attribute. Hover over a browser icon to see the version that first introduced support for this HTML event attribute.
Desktop





Tablets & Mobile





