title: add div id and for attribute sequentially using js
body: <p>I want to dynamically add the id and for attribute for each input and label element.</p>
  
  <pre><code>  &lt;div id="splash"&gt;
      &lt;div class="tab"&gt;
        &lt;input id="tab-1"&gt;
        &lt;label for="tab-1"&gt;&lt;label&gt;
      &lt;/div&gt;
  
     &lt;div class="tab"&gt;
       &lt;input id="tab-2"&gt;
       &lt;label for="tab-2"&gt;&lt;label&gt;
     &lt;/div&gt;
  
     &lt;div class="tab"&gt;
       &lt;input id="tab-3"&gt;
       &lt;label for="tab-3"&gt;&lt;label&gt;
     &lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>So basically I would want the id for the input to be tab-# with the # increasing by 1 for each input field and the same for the "for=" attribute for the label.</p>