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.
4 Respostas
0
Found the answer.
I did something weird and now it works.
0
care to share the working code?
0
sure.
function BackSpace()
{
cal.in.value = (cal.in.value).slice(0, -1);
if(cal.in.value == ' ')
{
para.innerHTML = ' ';
cal.in.value="0";
}
}
0
Its nice to see people as passionate as you