Skip to content
Advertisement

How to set a variable to the output of a form’s input?

Let’s say I have the following code, and I want to have N1 and N2 equal the inputs of numberInput1 and numberInput2 respectively. How would I do that?

JavaScript
JavaScript

Advertisement

Answer

This is one way you could do it. It won’t create global variables, but if you really need global variables, you can modify to taste.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement