title: JQuery: Access original jquery object within each
body: <p>I'm trying to implement HTML radio button behaviour on a set of DIVs in JQuery. I want to remove the "set" class from all the elements then use addClass() to re-set the (one) element that is clicked:</p>
  
  <pre><code>$(".button").each(function() {
    $(this).click(function(){
      // what goes here to call removeClass() on *all* the elements?
      $(this).addClass("set");
    });
  });
  </code></pre>
  
  <p>I want to call removeClass() on all the elements - in this case $(".button"), but I can't refer to $(".button") explicitly.</p>
  
  <p>I can't just call $(".button").removeClass("set") outside the loop as this is part of a bigger program and the behaviour inside the each() loop can be modified by other parameters. </p>
  
  <p>Is there any way to access the full set of elements from inside, or pass them in as a variable? Or is there another way to approach the problem?</p>