title: Javascript conflict with 'this' reference
body: <p>I have a piece of javascript code (using jQuery) that says:</p>
  
  <pre><code>$('.duration').each(function() {
      $(this).html(this.duration_text);
  });
  </code></pre>
  
  <p>It's iterating over each element of class 'duration' and setting the text as needed. The problem, is that the text it is setting is from a member variable, hence the this.duration_text. The 'this' reference is getting clobbered by the 'this' reference used by jQuery in the iteration.</p>
  
  <p>How can I avoid this collision?</p>
  
  <p>Although the underlying concept of the answer may be the exact same as the question this is marked as a duplicate of, it isn't immediately clear to me that this is the same question. In hindsight, sure, but while searching myself I didn't find it, nor was it clear it was the same question if I did find it.</p>