Struggling with creating functionalities for a simple calculator using vanilla.js. Able to display numbers on click but facing issues with multiple clicks and deletion of values. Trying to use addeventlistener but encountering a Type Error "addeventlistener not a function". Any recommended websites or tutorials to improve understanding of vanilla.js? Thank you in advance.
var result = document.querySelector('#result'); var clear = document.querySelector('#delete'); var backSpace = document.querySelector('.backspace'); var numbers = document.querySelectorAll('.input-btn'); var operators = document.querySelector('.operator-right'); var equalBtn = document.querySelector('.equal-btn'); function insert(num) { result.value = num; } <div class="container"> <div class="calc"> <div class="result"> <input class="input-btn__result" id="result" value="0"> </div> <div class="btns"> <input class="clear" id="delete" type="button" onClick="clear()" value="C"> <input class="backspace" type="button" name="" value="<"> <input class="input-btn__divide operator-right" type="button" name="" value="/"> <input class="input-btn" type="button" onClick="insert(1)" value="1"> <input class="input-btn" type="button" onClick="insert(2)" name="" value="2"> <input class="input-btn" type="button" onClick="insert(3)" name="" value="3"> <input class="input-btn operator-right" type="button" name="" value="*"> <input class="input-btn" type="button" onClick="insert(4)" name="" value="4"> <input class="input-btn" type="button" onClick="insert(5)" name="" value="5"> <input class="input-btn" type="button" onClick="insert(6)" name="" value="6"> <input class="input-btn operator-right" type="button" name="" value="+"> <input class="input-btn" type="button" onClick="insert(7)" name="" value="7"> <input class="input-btn" type="button" onClick="insert(8)" name="" value="8"> <input class="input-btn" type="button" onClick="insert(9)" name="" value="9"> <input class="input-btn operator-right" type="button" name="" value="-"> <input class="input-btn" type="button" onClick="insert('.')" name="" value="."> <input class="input-btn" type="button" onClick="insert(0)" name="" value="0"> <input class="equal-btn" type="button" name="" value="="> </div> </div> </div>