Hi, I am trying to access the content of an html input field and pass the content as a string when I press "enter" or the button.
html.div(
[attribute.class("flex gap-2 mb-6")],
[
html.input(
[
attribute.type_("text"),
attribute.placeholder("Player name"),
attribute.id("player-name-input"),
attribute.class("input input-bordered flex-1"),
event.on_keyup(fn(evt) {
case evt {
"Enter" -> AddPlayer("New Player")
_ -> NoOp
}
})
]
),
html.button(
[
attribute.class("btn btn-primary"),
event.on_click(GetPlayerNameAndAdd)
],
[html.text("Add Player")]
)
]
)