title: How does jQuery hijack "this"?
body: <p>I'm just curious to know how jQuery is able to hijack the 'this' keyword in Javascript.  From the book I'm reading: "Javascript the Definitive Guide" it states that "this" is a keyword and you cannot alter it like you can with an identifier.  </p>
  
  <p>Now, say you are in your own object constructor and you make a call to some jQuery code, how is it able to hijack this from you?</p>
  
  <pre><code>function MyObject(){
      // At this point "this" is referring to this object
      $("div").each(function(){
          // Now this refers to the currently matched div
      });
  }
  </code></pre>
  
  <p>My only guess would be that since you are providing a callback to the jQuery each() function, you are now working with a closure that has the jQuery scope chain, and not your own object's scope chain.  Is this on the right track?</p>
  
  <p>thanks</p>