diff --git a/index.html b/index.html index 31c213f..4b67927 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@

Calculator

-
+
0
@@ -37,6 +37,6 @@ - + \ No newline at end of file diff --git a/script.js b/script.js index 51eb95e..e53a78c 100644 --- a/script.js +++ b/script.js @@ -1,3 +1,20 @@ +const screen = document.querySelector(".screen") +const buttons = document.querySelectorAll("button") + +buttons.forEach((button) => { + button.addEventListener ("click", displayToScreen); +}); + +function displayToScreen() { + + if(this.className == "equal") { + //testButton(); + } else { + screen.textContent = this.textContent; + console.log("A button was pressed") + } +} + function Calculator(str) { this.methods = { diff --git a/style.css b/style.css index 7c75ff2..362240a 100644 --- a/style.css +++ b/style.css @@ -34,6 +34,7 @@ main { grid-column: 1 / span 4; height: 100px; background: #eee; + color: #111; } button {