Q:

How to use the number input in javascript?

I tried something like this code here, but it did not work and I'm completely clueless since I searched the web for answers and end did not find none. This is not the exact code I wrote but it's an idea of what I know so far, if anyone can help me I appreciate.
<body>
 <input type="number" id="j" step="1">
 <div id="a" style="position:absolute;background-color:black;width:100px;height:100px"></div>
 <script>
 var move=document.getElementById("a");
 var n = document.getElementById("j").value;
 move.style.left=n+++"px";
 </script>
</body>

A:

This will answer your problem..
you have to put a onchange="moveIt()" onkeyup="moveIt()" on your input tag for the div to know that it has
to move everytime you enter new values.
for example :
 <input type="number" id="j" step="1" onchange="moveIt()" onkeyup="moveIt()"/>

and on javascript :
function moveIt(){
 var move=document.getElementById("a");
 var n = document.getElementById("j").value;
 move.style.left=n+++"px";

}

