title: JQuery - Click listener not firing when trigger classes are swapped
body: <p>I have a jQuery on click listener that looks for class 'install-plugin'.</p>
  
  <p>When clicked, it changes the class (via jQuery) to 'delete-plugin'.</p>
  
  <p>And vice versa, so there is a listener for 'delete-plugin' that, when clicked, changes the class to 'install-plugin'.</p>
  
  <p>The problem I have is that this only works once, and although I can see the classes have updated on the page correctly, jQuery doesn't seem to see that and still fires the original listener.</p>
  
  <p>(The ajax is necessary for the intended, extended functionality). Is it possible to have jQuery always be up to date with what's on the page without hard refreshing it?</p>
  
  <pre><code>$(document).ready(function() {
      $('.install-plugin').click(function() {
          var id = $(this).attr('id');
          var postData = {
              action : 'install_plugin',
          }
          $.ajax({
              method: 'POST',
              url: "/wp-admin/admin-ajax.php",
              data: postData,
              success: function(response) {
                  $('#'+id).text('Delete');
                  $('#'+id).removeClass('install-plugin');
                  $('#'+id).addClass('delete-plugin');
              }
          });
      })
  
      $('.delete-plugin').click(function() {
          var id = $(this).attr('id');
          var postData = {
              action : 'delete_plugin',
          }
          $.ajax({
              method: 'POST',
              url: "/wp-admin/admin-ajax.php",
              data: postData,
              success: function(response) {
                  $('#'+id).text('Install');
                  $('#'+id).removeClass('delete-plugin');
                  $('#'+id).addClass('install-plugin');
              }
          });
      })
  });
  </code></pre>