Skip to content

Files

Latest commit

 

History

History
20 lines (18 loc) · 548 Bytes

3-js-dom.md

File metadata and controls

20 lines (18 loc) · 548 Bytes
optionId scastieLink codeTitle description
js-dom-api
Target the Web with Scala.js on the frontend
Share code full-stack, interact with the DOM or use any JS library.
val counter = Var(0)

// create a counter button that increments on-click
def counterButton() = button(
  tpe := "button",
  "count is ",
  child.text <-- counter,
  onClick --> { event => counter.update(c => c + 1) },
)
val app = dom.document.getElementById("app")
render(app, counterButton())