title: jQuery doesn't react on click on added class
body: <p>I have a rather simple script where I want a div to disappear when jQuery loads, add an "trigger" element on which I can click so that the div appears again. Then the class of the "trigger" is changed and when I click that again, the div should disappear again.. unfortunately the script works fine just until the "trigger" class is changed, if I click it again nothing happens. </p>
  
  <p><strong>QUESTION SOLVED</strong></p>
  
  <p>Here is the <strong>working</strong> JS:</p>
  
  <pre><code>$(document).ready(function () {
  if ($('#Bestellungen #Offene .products')) {
      $('#Bestellungen #Offene .products').hide();
      $('#Bestellungen #Offene .products').before('&lt;div class="trigger"&gt;&lt;/div&gt;');
      $('#Bestellungen #Offene').on('click', '.trigger', function () {
          $(this).addClass('minus').next().show();
      });
      $('#Bestellungen #Offene').on('click', '.trigger.minus', function () {
          $(this).removeClass('minus').next().hide();
      });
  }
  </code></pre>
  
  <p>});</p>
  
  <p>And here the HTML:</p>
  
  <pre><code>&lt;div id="Bestellungen"&gt;
  &lt;div id="Offene"&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;div class="products"&gt;blablabla&lt;/div&gt;
              &lt;td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>