I am creating an online calculator but I am having trouble when a user enters their equation in the text box I can get the equation evaluated and displayed in the console log but, I can't get it to replace the equation with the answer. If “=” is clicked, it should evaluate the equation in the textbox and replace the equation with the answer. This is what I have so far.
const equalsButton = document.querySelector('input[value="="]').onclick = function(){
var inputVar = document.querySelector('[name=equation]').value
console.log(eval(inputVar));
return false;
}