title: Limit tag depth on given html string
body: <p>I've looked on SO for a while and can't find and answer.</p>
  
  <p>Say I have a set of nested tags in an html string:</p>
  
  <pre><code>&lt;blockquote&gt;
      &lt;blockquote&gt;
          &lt;blockquote&gt;
              &lt;blockquote&gt;
                  Some Text 1
              &lt;/blockquote&gt;
              Some Text 2
          &lt;/blockquote&gt;
      Some Text 3
      &lt;/blockquote&gt;
      &lt;blockquote&gt;
      Text!
          &lt;blockquote&gt;
          Text 2!
          &lt;/blockquote&gt;
      &lt;/blockquote&gt;
  Some Text 4
  &lt;/blockquote&gt;
  </code></pre>
  
  <p>In jquery, how do I take that html string and convert it to another html string but removing the nth nested blockquote. So if I limited it to two, this would remain:</p>
  
  <pre><code>&lt;blockquote&gt;
      &lt;blockquote&gt;
      Some Text 3
      &lt;/blockquote&gt;
      &lt;blockquote&gt;
      Text!
      &lt;/blockquote&gt;
  Some Text 4
  &lt;/blockquote&gt;
  </code></pre>
  
  <p>Preferably, the function's prototype should look like this:</p>
  
  <pre><code>var limit = 2;
  myHtmlString = limitQuotes(myHtmlString, limit);
  </code></pre>
  
  <p>Any direction on the matter would be helpful.</p>