This repository was archived by the owner on Oct 9, 2022. It is now read-only.
File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ You can attach event handlers to DOM elements:
9
9
10
10
.. code-block :: kotlin
11
11
12
- doc.body.new {
12
+ doc.body {
13
13
val label = h1()
14
14
label.text("Click Me")
15
15
label.on.click {
@@ -21,7 +21,7 @@ Most if not all JavaScript event types are supported, and you can read event dat
21
21
22
22
.. code-block :: kotlin
23
23
24
- doc.body.new {
24
+ doc.body {
25
25
val input = input(type = text)
26
26
input.on.keypress { keypressEvent ->
27
27
println("Key Pressed: ${keypressEvent.key}")
@@ -39,7 +39,7 @@ Fortunately, Kweb has a solution:
39
39
40
40
.. code-block :: kotlin
41
41
42
- doc.body.new {
42
+ doc.body {
43
43
val label = h1()
44
44
label.text("Click Me")
45
45
label.onImmediate.click {
@@ -60,4 +60,4 @@ Combination event handlers
60
60
61
61
A common pattern is to use both types of event handler on a DOM element. The immediate handler might disable a clicked
62
62
button, or temporarily display some form of `spinner <https://loading.io/css/ >`_. The normal handler would then do
63
- what it needs on the server, and then perhaps re-enable the button and remove the spinner.
63
+ what it needs on the server, and then perhaps re-enable the button and remove the spinner.
You can’t perform that action at this time.
0 commit comments