1// 1. Create the button
2var button = document.createElement("button");
3button.innerHTML = "Do Something";
4
5// 2. Append somewhere
6var body = document.getElementsByTagName("body")[0];
7body.appendChild(button);
8
9// 3. Add event handler
10button.addEventListener ("click", function() {
11 alert("did something");
12});
13
14/* Read
15
16https://css-tricks.com/use-button-element/
17*/