title: How can I make onClick apply to the label of a number form?
body: <p>I have a page where with about 100 number forms. Each form has a different label, name, id, etc. This is to apply some other javascript later on.</p>
  <p>Two questions: Is it possible to rig the javascript so the number form increases by one when clicking on the <em>label</em> (ie. click on &quot;Apples&quot;) rather than the number box? And since every form has a different id, is it possible to grab each form by something other than its id (an alternate catch-all so it can easily be applied to around 100 different forms)?</p>
  <p>Thank you in advance!</p>
  <pre><code>&lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
  &lt;script&gt;
      var i = 0;
      function onClick() {
          document.getElementById('applesQuantity').value = ++i;
      }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  
  &lt;label&gt;Apples &lt;/label&gt;&lt;input type=&quot;number&quot; name=&quot;apples-quantity&quot; id=&quot;applesQuantity&quot; onclick=&quot;onClick()&quot;&gt;
  &lt;label&gt;Oranges &lt;/label&gt;&lt;input type=&quot;number&quot; name=&quot;oranges&quot; id=&quot;orangesQuantity&quot; onclick=&quot;onClick()&quot;&gt;
  
  &lt;/html&gt;
  </code></pre>