Javascript document.getElementById issue

I am a beginner to javascript, and am trying to learn how to use text boxes because I can't seem to find a page that is simple enough for me. This is what I have, but when I click the button, it just returns [object HTMLInputElement]. Could someone please tell me what i did wrong and help me fix it? Thanks.

<script language="javascript">
function displaynumber(){
var number1= document.getElementById("num1");
Input the first number<input type="text" id="num1">
<input type="button" value="submit" onClick="displaynumber()">


You should correct your typo:




You are alerting number1 and then trying to read the value property of the return value of alert().

Move the property accessor inside the function call.


Need Your Help

Jena TDB in Python?

python storage jena

Is it possible to run a Jena TDB database from a Python app to store a large amount of RDF data? What would be a native alternative in Python?

How to register invoice payment


When I choose the method of payment the amount is reset to 0 and if I confirm the payment of the invoice the state does not change (open to paid) and there is no error message. I can't set any invo...