I have this very basic calculator:
<html>
<body>
<form name="form">
<input type="text" name="num1" />
<input type="text" name="num2" />
<input type="text" name="res" />
<input type="button" value="+" onclick="form.res.value = form.num1.value + form.num2.value" />
</form>
</body>
</html>
But it treats form.num1.value
and form.num2.value
as string and because of it the result is the concatenation of these values instead of addition.
How to treat them as numbers?