I am making a javascript tool to convert decimal number value to HEX.
setInterval(
function tohex() {
var decimal = document.getElementById('result').value;
var hex = decimal.toString(16).toUpperCase();
document.getElementById("hex").value = hex;
});
<input type='text' id="result" size="4" placeholder="Decimal" value="44032"/>
<input type="text" id="hex" oninput="tohex()" size="4" placeholder="HEX"/>
When var decimal = 44032;
, the snippet shows the correct result: AC00. The value of the text input is 44032 as well, but in this case the script does not seem to render the correct hex value. What is the problem here, and how should I edit the script to render the 'correct' result?