title: Jquery not detecting dynamically created element
body: <p>I'm trying to get jQuery to create an alert when the class 'open' gets added to 'ul.foo':</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;span&gt;Some text&lt;/span&gt;
  &lt;ul class="foo"&gt;
      &lt;li&gt;1&lt;/li&gt;
      &lt;li&gt;2&lt;/li&gt;
      &lt;li&gt;3&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>$('ul.foo li').hide();
  
  $("span").click(function(){
      $('ul.foo li').slideDown();
      $('ul.foo').addClass('open');
  });
  
  if ($('ul.foo.open').length){
      alert('ul open');
  }
  </code></pre>
  
  <p>Fiddle: <a href="https://jsfiddle.net/j8sL5oh4/1/" rel="nofollow">https://jsfiddle.net/j8sL5oh4/1/</a></p>
  
  <p>What am I missing?</p>