Calculator delete button? | Sololearn: Learn to code for FREE!


Calculator delete button?

So I wrote this simple calculator. Is there a way to add a delete button so I can delete the last value entered? Ex: 1+1 *presses delete button* 1+

6/1/2018 12:02:44 AM

Daniel Cooper

7 Answers

New Answer


Just add <td><input class="button" type="button" value="DEL" onclick="calculator.display.value = calculator.display.value.substr(0,calculator.display.value.length-1)"></td>


Thanks. And since i'm very new to coding, I was wondering what the "0," means.


this means that you create a new string with the same characters except for the last one.


Now what would be the result if I were to put a 1 there instead? I guess I could have found out myself before typing this, but i'll send it anyway. xD


You then would also remove the first character.


Lol. I figured it out yesterday. Thanks though


I need help with it.