Created
February 6, 2019 18:03
-
-
Save EvanGertis/f8c2a10c9f185ba4e6d1d3e4010586ae to your computer and use it in GitHub Desktop.
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
"use strict" | |
// select div. | |
let demoDiv = document.getElementById("demo-div"); | |
// run the function to build the button and | |
// add it to the html. | |
buildUI(); | |
function buildUI(){ | |
// create new button and add it to the div. | |
let button = document.createElement('input'); | |
button.type = "submit"; | |
button.innerHTML= "submit" | |
button.addEventListener("click", logButton); | |
demoDiv.appendChild(button) | |
} | |
function logButton(){ | |
// log to the console when the button is clicked. | |
console.log("The button was clicked.") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment