From 45b8ab72e61969b9f9d0a3c87146955aee89d082 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 26 Jan 2024 13:25:16 -0600 Subject: [PATCH] add backspace key --- css/style.css | 9 +++++++-- index.html | 3 ++- js/main.js | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/css/style.css b/css/style.css index a7a94bf..7dacdcc 100755 --- a/css/style.css +++ b/css/style.css @@ -53,11 +53,16 @@ body { /* border: none; */ } -.clear, -.zero { +.clear { flex: 2 auto !important; } +.backspace { + display: flex; + align-items: center; + font-size: 2rem; +} + /****************************************** /* LAYOUT /*******************************************/ diff --git a/index.html b/index.html index 4e357c0..4287fe5 100755 --- a/index.html +++ b/index.html @@ -41,8 +41,9 @@
+
-
0
.
+
0
+
=
diff --git a/js/main.js b/js/main.js index 7f3af44..484b7ef 100644 --- a/js/main.js +++ b/js/main.js @@ -46,6 +46,11 @@ document.querySelector(".clear").addEventListener("click", function () { display.textContent = "0"; }); +document.querySelector(".backspace").addEventListener("click", function () { + calc.delete(); + showCurrentNum(); +}); + document.querySelector(".divide").addEventListener("click", function () { calc.divide(); showCurrentNum();