How do I link up the 3 functions below so I can have mathFormula output an answer?
HTML text:
<div id = "rowContainer"></div>
JavaScript text:
function mathFormula(x, y) {
return x * y;
}
const mainDiv = document.getElementById("rowContainer");
function newRow() {
const input1 = document.createElement("input");
mainDiv.appendChild(input1);
const input2 = document.createElement("input");
mainDiv.appendChild(input2);
const result = document.createElement("div");
mainDiv.appendChild(result);
}
mainDiv('keyup', function() {
const a = input1.value;
const b = input2.value;
const sum = mathFormula(a,b);
result.textContent = sum;
})