title: How to dynamicly add class and id to specific tag using Javascript/JQuery
body: <p>This is my html</p>
  
  <pre><code>&lt;h1&gt;Lorem Ipsum&lt;h1&gt;
  &lt;h2&gt;Lorem Ipsum first h2&lt;h2&gt;
  &lt;h2&gt;Lorem Ipsum second h2&lt;h2&gt;
  &lt;h2&gt;Lorem Ipsum third h2&lt;h2&gt;
  </code></pre>
  
  <p>how to add class="sampleClass" to each h2 tag and give them id with increment number for each h2 tag using javascript/jquery?</p>
  
  <p>so i can get the folowing</p>
  
  <pre><code>&lt;h1&gt;Lorem Ipsum&lt;h1&gt;
  &lt;h2 class="sampleClass" id="0"&gt;Lorem Ipsum first h2&lt;h2&gt;
  &lt;h2 class="sampleClass" id="1"&gt;Lorem Ipsum second h2&lt;h2&gt;
  &lt;h2 class="sampleClass" id="2"&gt;Lorem Ipsum third h2&lt;h2&gt;
  </code></pre>
  
  <p>maybe i have to using loop but i cant do that yet :(</p>
  
  <p>Thanks</p>