title: How to get value from input type = number?
body: <p><strong>Problem</strong></p>
  
  <p>So my problem is that I have an <code>&lt;input type='number'&gt;</code>, and I'm trying to get the value of the input when the user clicks <code>enter</code> and <code>console.log()</code> the value. But when I tested, it returned <code>undefined</code>.</p>
  
  <p><strong>Input</strong></p>
  
  <pre><code>&lt;input type="number" value="0" placeholder="Enter Number..." class="insert"&gt;
  </code></pre>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>function main() {
  
          var input = document.getElementsByClassName('insert');
  
          document.addEventListener('keydown', function(e) {
              if(window.event == 13 || e.which == 13) {
  
                  var num = input.value;
  
                  console.log(num)
  
                  /*if(num &lt; 0) {
                      alert('Please enter a positive number');
                  }*/
  
              }
          })
  
      }
  
      window.onload = main;
  </code></pre>