Introduction
This mixin provides event handlers that run when an element is clicked or double-clicked.
About Mixins
Mixins provide functionality that other elements can inherit and use.
Mixins are not elements. You cannot add mixins to a page in the Editor like other $w
elements, and mixins are not meant to be used directly
in your code.
For example, you would not write code like this, because it is out of context:
javascript | Copy Code$w("#ClickableMixin").onClick( (event) => {let targetId = event.target.id;});
Instead, you can code the following if myButton
is an element that can be clicked and
"mixes in" ClickableMixin
.
javascript | Copy Code$w("#myButton").onClick( (event) => {let targetId = event.target.id;});
Was this helpful?