title: Using jQuery's .on function how do I get the originating element for the event?
body: <p>I had code like this:</p>
  
  <pre><code>$('.remove-group').click(function () {
      $(this).closest('tr').remove();
  });
  </code></pre>
  
  <p>This worked fine until I needed to use delegated event handler to capture clicks for elements that will be added to the page in the future.</p>
  
  <pre><code>$(document).on('click', '.remove-group', function () {
      $(this).closest('tr').remove();
  });
  </code></pre>
  
  <p>This no longer works because the <code>this</code> keyword does not refer to the originating element.</p>
  
  <p>Any ideas?</p>
  
  <h2>Update</h2>
  
  <p>It would seem that in my efforts to simplify the code for my question I actually made it work. I was actually passing in a wrapped set that was assigned to a variable instead of the string selector.</p>
  
  <pre><code>var $removeGroup = $('.remove-group');
  $(document).on('click', $removeGroup, function () {
      $(this).closest('tr').remove();
  });
  </code></pre>
  
  <p>That doesn't seem to work when I do it that way.</p>