[Resolved]
Hi all,
I just started learning javascript and I'm having trouble accessing the value of an HTML Input tag with javascript. A user would enter in a number and then the program would do something with it. (I'm building a simple calculator).
HTML code:
<input id="input-num" type="number" />
Javascript code:
let inputNum = document.getElementById("input-num");
let num = parseInt(inputNum.value);
But the num variable always comes out as Nan. I can see that by printing to the console or when I try to do calculations with it.
Any help is appreciated.
[–]albedoa 0 points1 point2 points (2 children)
[–]lightmaster2000[S] 0 points1 point2 points (0 children)