How can I capture a numeric input from an HTML doc and save it as a numeric value in JS?

  html, javascript
<div class = "input">
    <b>Weight </b><input type = '' id = 'weight' value = '180'>
</div>
<script>
    let weight = document.getElementById('weight');
    console.log(weight/2.205);
</script>

The output is NaN. Is there a solution that will convert ‘weight’ into the proper value? Thank you for your time and patience.

Source: Ask Javascript Questions

LEAVE A COMMENT