I have a problem.
My JQuery calculator keeps on deleting my existing number each time I click a new one. I’m sure it’s defaultFor example if I click 1, it displays, but if I click two it takes away the one and replaces it with two. I’ve tried using
push()
but it doesn’t work. Pls is there any other thing I can try? Thank you in advance and happy coding! Here’s the pen. I’m using the first 20 lines for the calculator. Pls any help will be HIGHLY appreciated
You are changing the text of #display
with $("#display").text("1")
, therefore when you click 1, it replaces text in #display
entirely with “1”
I’m not very familiar with jQuery, but for key 1,
$("#display").text("1"+$("#display").text())
works…
I think, you should try this, and find the standard solution…
Thanks you’re right. I just flipped it to $("#display").text $("#display").text () + "1")
and it worked.
Pls, explain more. Sorry
So sorry, I think I’m frustrated today… I gave you wrong advice… Actually mine code is wrong… I’ll delete the reply…
Ok, thanks, but the first reply you gave me helped me to formulate the right one.