Skip to content
← Back to Community
Input value not working
Profile icon
MilescOde

I'm making a calculator and for some weird reason when I try to get the inputs and add them when I try it it doesn't have any output. Not even
'[Object InputHTMLElement][Object InputHTMLElement]'.

Voters
Profile icon
MilescOde
Comments
hotnewtop
Profile icon
SixBeeps

getElementById returns a DOM object. You need to get the value property of the inputs to get the text that it holds.

let num1 = document.getElementById("num1").value; let sym = document.getElementById("sym").value; let num2 = document.getElementById("num2").value;
Profile icon
MilescOde

@SixBeeps Thanks!