title: How can I use querySelector on to pick an input element by name?
body: <p>I recently received help on this site towards using <code>querySelector</code> on a form input such as <code>select</code> but as soon as I took <code>&lt;select&gt;</code> out it completely changed what had to be done in the function.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form onsubmit="return checkForm()"&gt;
      Password: &lt;input type="text" name="pwd"&gt;
      &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>&lt;script language="Javascript" type="text/javascript"&gt;
      debugger;
      function checkForm() {
          var form = document.forms[0];
          var selectElement = form.querySelector('');
          var selectedValue = selectElement.value;
  
          alert(selectedValue);
  &lt;/script&gt;
  </code></pre>
  
  <p>Before, I had <code>('select')</code> for the <code>querySelector</code>, but now I'm unsure what to put there.<br>
  I've tried multiple things as well as <code>querySelectorAll</code> but I can't seem to figure it out. </p>
  
  <p>To be clear I'm trying to pull the <code>name="pwd"</code>.</p>
  
  <p>How could I do this?</p>