How to add two numbers in JavaScript using textbox?

To add two numbers in JavaScript using textbox, do this: parseInt(input1.value) + parseInt(input2.value).

So if these are your textboxes and a button:

<input type="number" id="textbox1">
<input type="number" id="textbox2">
<button id="myButton">Add them together</button>

Then you can add two numbers and show the result in a popup with this JavaScript:

document.getElementById("myButton").addEventListener("click", () => {
  const number1 = parseInt(document.getElementById("textbox1").value);
  const number2 = parseInt(document.getElementById("textbox2").value);
  alert(number1 + number2);
});