+ 1
Why javascript is not working in this calculator.
5 Answers
+ 5
I noticed 3 issues:
1. Your html input field only allows numbers â we cannot enter "+" for example. Consider using type="text" instead of type="number"
2. In line 8 of your js there is a typo: It needs to be innerText instead of innertext.
3. When the js is executed, the html is not fully loaded yet, so it doesn't find the html element that you try to get in the js code. Consider putting all your js code inside of window.onload:
window.onload = function() {
// here your js
}
+ 4
Line 6 innertext should be innerText
+ 2
I think you've declared a few things incorrectly.
Why not use ids for each button and add event listeners for each?
0
Bcz I have to do it differently and also to save time.
0
Thanks Lisa for help now it's working.