title: w3schools example regarding jQuery callback function with index
body: <p>In <a href="http://www.w3schools.com/Jquery/jquery_dom_set.asp" rel="nofollow">this</a> example, a jQuery function is presented that when clicked, it prints out the old text and the new text of the element, plus the index of the current element. I'm pretty sure the index must increment (because new elements are being added). But upon testing the code, why is the index showing 0 all the time?</p>
  
  <pre><code>$("#btn1").click(function(){
    $("#test1").text(function(i,origText){
      return "Old text: " + origText + " New text: Hello world!
      (index: " + i + ")"; 
    });
  });
  
  $("#btn2").click(function(){
    $("#test2").html(function(i,origText){
      return "Old html: " + origText + " New html: Hello &lt;b&gt;world!&lt;/b&gt;
      (index: " + i + ")"; 
    });
  });
  </code></pre>