0

How to make a letter eraser?

I've finally made a big, draggable calculator that can calculate *,/,+,-,square root and PI. (And use parantheses). I got a reset button but I need an erase button that only deletes one letter. How do you make that? I've tried this: function BackSpace() { cal.in.value-=" "; } But it doesn't work and the input field just displays NaN. For the reset button I use: function Reset() { cal.in.value+=" "; }. I use similar functions for all other inputs. But I need a way to delete a single letter.

20th Aug 2016, 4:55 PM
Oscar
Oscar - avatar
4 Answers
0
Found the answer. I did something weird and now it works.
20th Aug 2016, 9:05 PM
Oscar
Oscar - avatar
0
care to share the working code?
21st Aug 2016, 1:48 AM
Khalid
Khalid - avatar
0
sure. function BackSpace() { cal.in.value = (cal.in.value).slice(0, -1); if(cal.in.value == ' ') { para.innerHTML = ' '; cal.in.value="0"; } }
21st Aug 2016, 4:06 PM
Oscar
Oscar - avatar
0
Its nice to see people as passionate as you
21st Aug 2016, 4:11 PM
Khalid
Khalid - avatar