HTML
<label>Width in mm:</label><br>
<input type="number" min=0 class="spacerSize" id="width" /><br/>
<label>Height in mm:</label><br>
<input type="number" min=0 class="spacerSize" id="height" /><br/>
<button class="btn btn-hero" onclick="showResults()">click me</button>
JS
var width = document.getElementById("width").value;
var height = document.getElementById("height").value;
function showResults() {
console.log(width);
width = parseInt(width);
height = parseInt(height);
console.log(width);
console.log(height);
}
когда нажыимаю кнопку, получается NaN. Почему?