Last active
September 1, 2019 09:00
-
-
Save mdecourse/9d7b66d3a0e6458618a7cd26e16265d8 to your computer and use it in GitHub Desktop.
Say Hello in Dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Hello, <span id="name"></span></h1> | |
<input type="text" id="name_box"> | |
<input type="submit" value="Say Hello" id="button"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = ""; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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