So, I was making a program in html that would convert any decimal number to a binary number, which was working perfectly, then I tried to modify it, and screwed it up somehow. The problem seems to be it takes the value at the start of the runtime, rather than always grabbing it at the moment, but it wasn't doing that before. And, I have no idea why it's doing it, and I'm not completely sure what I'd even look up to look for this kind of error, especially when I have no idea what is wrong.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input type = "number" id = 'decimal'></input><br/>
<a id = 'binary'></a>
<script>
setInterval(convert(),1);
function convert() {
var nNum = "";
var num = document.getElementById('decimal').value;
while(num != 0) {
nNum = (num % 2) + nNum;
num = Math.floor(num/2);
}
document.getElementById('binary').innerHTML = nNum;
}
</script>
</body>
</html>
any and all help is greatly appreciated. c: