Skip to content
Sergey Mashkov edited this page Jul 3, 2015 · 5 revisions

Events

Many html elements have a set of events that could be handled. To handle an event you have to specify corresponding attribute value. In streaming mode you can specify only plain text on both JVM and browsers platforms. However in the DOM mode of browser target you also can specify a lambda to be executed as event handler if you import kotlinx.html.js.*

div {
    onclick = { event ->
        window.alert("Kotlin!")
    }
}

🔴 Notice In library for browser target you can import and use such kind handlers even in streaming mode but you shouldn't because it will not work: there is no way to dump lambdas to the text for now