You can use document.getElementById("input_field_id");
or you can use:
var form=document.forms["form_name"];
var input_value= form["input_field_id"].value;
Note that the typeof(input_value)
will be string even if the type of the input field is “number”.
So even if you enter an integer in the field Number.isInteger(input_value)
will return false
and typeof(input_value)
will return string
.