view in github

Examples for the on-event library

Simple example

add the on-click attribute, to add a basic handler to the element.

Example for input elements

add the on-change attribute, to add a basic handler to the element.

Using complex event names

most event names have easy names but this library may accept almost any type of event name. e.g. show.bs.modal

Mapping the names to not-only-lowercase names

While most event names are lowercase, some events may use some capital letters in their name (or weird characters such as *). In these cases we can use the :map suffix to add a translation.

In this example, the on-capitalevent attribute will be translated to on-CapitalEvent event name

(*) Attributes always appear in lowercase in the DOM so for javascript it does not have effect to write the attribute as on-CapitalEvent directly: it will attive to javascript as on-capitalevent