So I have some HTML code:
<input type="number" id="height">
I want to take whatever is entered in this box and use it as an int/float etc. Lets say I enter "2". Heres the JavaScript code:
var test;
var a;
test = document.getElementById('height').value;
a = 2 + test;
When I print a, I get 22. This makes sense, but I want 4. In other words, I want test to be treated as an int/float (whatever is entered in the text box). Is there an HTML input type that will do this for me, or do I have to change it another way (like JavaScript commands).