How to reset your calculator8/28/2023 You can also clear your total by adding this to the reset() function: document.getElementById("inputTotal").innerHTML = "" value = "" because it makes more sense in this case and should be used for input/form operations, while innerHTML is used for other elements (div, span, td, etc.) It can be easy to overlook wording and case sensitivity after looking at code for hours! They are leftInput and rightInput, not inputLeft and inputRight. The proper way to call this is getElementById with a lowercase "d" in "Id."Īlso, you were referencing the wrong id values. Your problem was that you were calling getElementByID on the document. A = Number(document.getElementById('leftInput').value) ī = Number(document.getElementById('rightInput').value) ĭocument.getElementById('inputTotal').innerHTML = result ĭocument.getElementById("leftInput").value = "" ĭocument.getElementById("rightInput").value = ""
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |