Skip to content

Instantly share code, notes, and snippets.

@mdecourse
Last active September 1, 2019 09:00
Show Gist options
  • Save mdecourse/9d7b66d3a0e6458618a7cd26e16265d8 to your computer and use it in GitHub Desktop.
Save mdecourse/9d7b66d3a0e6458618a7cd26e16265d8 to your computer and use it in GitHub Desktop.
Say Hello in Dart
<h1>Hello, <span id="name"></span></h1>
<input type="text" id="name_box">
<input type="submit" value="Say Hello" id="button">
import 'dart:html';
void main() {
querySelector("#button").onClick.listen(sayHello);
}
void sayHello(MouseEvent event) {
querySelector("#name").text = (querySelector("#name_box") as InputElement).value;
(querySelector("#name_box") as InputElement).value = "";
}
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#wrapper {
width: 300px;
margin: auto;
border: solid thin black;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment