Mini events are based on the browser's native events. Most of the time you'll be using js-click
, js-change
, or js-press
, but the full list is here:
js-clickout
- This will trigger when the user clicks outside of the current element.js-clickme
- This will trigger when the user clicks the current element.js-change
- This will trigger when the user changes the value of a form input.js-press
- This will trigger when the user:
click
event.Enter
and Space
keys.touchstart
event.There are special variables and methods that you can use inside dynamic attributes and events:
this
- the current element$
- equal to the document.querySelector
.$$
- equal to the document.querySelectorAll
.wait
- a method that waits for a given amount of time.
Usage: <button js-click="await wait(1000); alert('Hello')">Click Me</button>