I have 2 inputs.
When I put 2 in the n1 input, the second input says 4.
But if I don't put anything in the first (n1), the second inpout (n2) says NaN
.
How remove this NaN
?
<td><input type="number" value=0 id="n1" oninput="test()"/> <br/><br/></td>
<td></td>
<td><input type="text" value=0 id="result" readonly/><br><br></td>
function test () {
var n1 = parseFloat(document.getElementById('n1').value);
var oper = document.getElementById('selector1').value;
var oper2 = document.getElementById('selector2').value;
if (oper === 'm' && oper2 === 's') {
document.getElementById('result').value = n1 * 60;
}
}