Adding (+) Two Form Field Numbers

Hello,

Is it possible to have a form field auto complete by adding the numbers from two other form fields?

Essentially looking to prevent a user from needing to add to numbers to get a sum.

Field 1 - 10 (Manual Input)
Field 2 - 25 (Manual Input)

Field 3 - (Auto Calculates) Field 1 (10) + Field 2 (25) = 35


Here is my site Read-Only: LINK
(how to share your site Read-Only link)

$(function() {
  $("#field_1").on("input", function() {
    calc();
  })
  $("#field_2").on("input", function() {
    calc();
  })
});

function calc() {
  const val1 = Number($("#field_1").val());
  const val2 = Number($("#field_2").val());
  $("#field_3").val(val1 + val2);
}

1 Like