title: How do I check whether a jQuery element is in the DOM?
body: <p>Let's say that I define an element</p>
  
  <pre><code>$foo = $('#foo');
  </code></pre>
  
  <p>and then I call</p>
  
  <pre><code>$foo.remove()
  </code></pre>
  
  <p>from some event. My question is, how do I check whether $foo has been removed from the DOM or not? I've found that <code>$foo.is(':hidden')</code> works, but that would of course also return true if I merely called <code>$foo.hide()</code>.</p>