title: Converting document.getElementsByClassName to Jquery
body: <p>I have the following piece of code, that i can't seem to convert to Jquery could someone help me out.</p>
  
  <p>Pure JS working code:</p>
  
  <pre><code>var elements = document.getElementsByClassName("glyphicon glyphicon-comment");
  for (var i = 0, length = elements.length; i &lt; length; i++) {
       $('#' + elements[i].id).tooltip();
       }
  }
  </code></pre>
  
  <p>My Jquery Attempts (both not working):</p>
  
  <p>Attempt 1:</p>
  
  <pre><code> $(".glyphicon glyphicon-comment").tooltip();
  </code></pre>
  
  <p>Attempt 2:</p>
  
  <pre><code>$(".glyphicon glyphicon-comment").each( function() {
      $(this).tooltip();
  });
  </code></pre>
  
  <p>Example of the button:</p>
  
  <pre><code>&lt;span class="glyphicon glyphicon-comment" data-toggle="tooltip" data-placement="left" id="commentTask1" data-original-title="This is comments"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>Could someone spot the error i've made?</p>
  
  <p>Thnx for your efforts.</p>