Here's a better example. It's modified from some code I'm working on but should
work. The H1 will update automatically as you type characters into the text
field. The text field itself actually won't update without us explicitly
changing its value using setInputText(). Not sure if that's intended behavior
or a bug.
from strutils import toUpper
include karax / prelude
var myText = ""
proc createDom(): VNode =
result = buildHtml(tdiv):
h1: text myText
input(value = myText):
proc onkeyup(ev: Event, n: VNode) =
myText = toUpper($n.value())
n.setInputText(myText)
setRenderer createDom
Run