Skip to content

Instantly share code, notes, and snippets.

@inoh
Last active Dec 19, 2015
Embed
What would you like to do?
Dart
import 'dart:html';
InputElement testInput;
UListElement testList;
ButtonElement testDelete;
void main() {
testInput = query("#test-input");
testList = query("#test-list");
testDelete = query("#delete-all");
testInput.onChange.listen(addList);
testDelete.onClick.listen(deleteAll);
}
void addList(Event e) {
var newList = new LIElement();
newList.text = testInput.value;
testInput.value = "";
testList.children.add(newList);
}
void deleteAll(Event e) {
testList.children.clear();
}
@inoh
Copy link
Author

inoh commented Jul 11, 2013

HTML

<h1>TestPage</h1>

<div>
  <input id="test-input" type="text"></input>
</div>    

<div>
  <ul id="test-list"></ul>
</div>

<div>
  <button id="delete-all" type="button">全件削除</input>
</div>

<script type="application/dart" src="test.dart"></script>
<script src="packages/browser/dart.js"></script>

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment