title: Events with multiple selectors - how to get triggering selector?
body: <p>When handling a jQuery event with multiple selectors, can I get the value of the selector triggered the event?</p>
  
  <p>I'm aware of <a href="https://stackoverflow.com/questions/12941806/jquery-multiple-selectors-get-which-selector-triggered-event">jQuery multiple selectors, get which selector triggered event</a> and similar questions, but none of them seem to contain an answer to the fundamental question.</p>
  
  <p>Suppose I have 3 buttons:</p>
  
  <pre><code>&lt;button class='red stop danger'&gt;red&lt;/button&gt;
  &lt;button class='amber floor-it caution'&gt;amber&lt;/button&gt;
  &lt;button class='green go safe'&gt;green&lt;/button&gt;
  </code></pre>
  
  <p>With the accompanying Javascript code:</p>
  
  <pre><code>var clickCounts = {
      red: 0,
      green: 0
  };
  
  // we only want to count red and green clicks
  $('.red, .green').click(function() {
      // can't use clickCounts[$(this).attr('class')] 
      // because there are multiple class values present
      clickCounts[??selector??] += 1;
  });
  </code></pre>
  
  <p>If the only way to achieve this is by making a bunch of calls to <code>is()</code> or <code>hasClass()</code>, or write per-button handlers etc. then so be it, but I have yet to see a definitive answer.</p>