Skip to content
This repository has been archived by the owner on Oct 9, 2022. It is now read-only.

Commit

Permalink
Update events.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Dec 8, 2020
1 parent f298778 commit 71de5cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ You can attach event handlers to DOM elements:

.. code-block:: kotlin
doc.body.new {
doc.body {
val label = h1()
label.text("Click Me")
label.on.click {
Expand All @@ -21,7 +21,7 @@ Most if not all JavaScript event types are supported, and you can read event dat

.. code-block:: kotlin
doc.body.new {
doc.body {
val input = input(type = text)
input.on.keypress { keypressEvent ->
println("Key Pressed: ${keypressEvent.key}")
Expand All @@ -39,7 +39,7 @@ Fortunately, Kweb has a solution:

.. code-block:: kotlin
doc.body.new {
doc.body {
val label = h1()
label.text("Click Me")
label.onImmediate.click {
Expand All @@ -60,4 +60,4 @@ Combination event handlers

A common pattern is to use both types of event handler on a DOM element. The immediate handler might disable a clicked
button, or temporarily display some form of `spinner <https://loading.io/css/>`_. The normal handler would then do
what it needs on the server, and then perhaps re-enable the button and remove the spinner.
what it needs on the server, and then perhaps re-enable the button and remove the spinner.

0 comments on commit 71de5cd

Please sign in to comment.