x
and y
refer to the <input>
elements, not to their values:
var y = document.getElementById('numY').value;
Also, pass the radix/base argument to parseInt
. You want it to be explicit that you're working in base 10:
var z = parseInt(y, 10) % parseInt(x, 10);