Skip to content

Commit

Permalink
add backspace key
Browse files Browse the repository at this point in the history
  • Loading branch information
dwnorm2 committed Jan 26, 2024
1 parent c08eb56 commit 45b8ab7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ body {
/* border: none; */
}

.clear,
.zero {
.clear {
flex: 2 auto !important;
}

.backspace {
display: flex;
align-items: center;
font-size: 2rem;
}

/******************************************
/* LAYOUT
/*******************************************/
Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@
<div class="add">+</div>
</div>
<div class="row">
<div class="zero">0</div>
<div class="decimal">.</div>
<div class="zero">0</div>
<div class="backspace"></div>
<div class="equals">=</div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 45b8ab7

Please sign in to comment.