title: Check if element is before or after another element in jQuery
body: <p>Let us suppose I have this markup</p>
  
  <pre><code>&lt;h3 id="first"&gt;First&lt;/h3&gt;
  &lt;p&gt;Hi&lt;/p&gt;
  &lt;p&gt;Hello&lt;/p&gt;
  &lt;h3 id="second"&gt;Second&lt;/h3&gt;
  &lt;p&gt;Bye&lt;/p&gt;
  &lt;p&gt;Goodbye&lt;/p&gt;
  </code></pre>
  
  <p>How can I programmatically check if an element, such as one of the <code>p</code>s, is after first <code>h3</code> and before the second <code>h3</code>, with jQuery?</p>
  
  <p>I am trying to do something like this:</p>
  
  <pre><code>$(p).each(function(){
     if($(this).isAfter("#first") &amp;&amp; $(this).isBefore("#second")) {
       // do stuff
     }
  });
  </code></pre>