title: Remove div and its content from html string
body: <p>Lets say i have a string like this:</p>
  
  <pre><code>&lt;div id="div1"&gt;&lt;/div&gt;
  &lt;div class="aClass" id="div2"&gt;  
     &lt;div id="div3" class="anotherClass"&gt;&lt;/div&gt;
     &lt;div id="div4" /&gt;
  &lt;/div&gt;
  &lt;div id="div5"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I want to remove div2 from the string and everything inside that div</p>
  
  <p>So i got a string like this</p>
  
  <pre><code>&lt;div id="div1"&gt;&lt;/div&gt;
  &lt;div id="div5"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I thinking something like using regex to find the first div with the id of "div2" or whatever the id of the div is and count brackets untill it gets to "&lt; /div>". The problem is that the "div3" also got a "&lt; /div>" at the end. </p>
  
  <p>The content of the div i want to remove may contain more or less div's then this too.</p>
  
  <p>Any ideas on how to code this?</p>
  
  <p>Update: </p>
  
  <pre><code>                var htmlText = editor3.getValue();
              var jHtmlObject = jQuery(htmlText);
              jHtmlObject.find("#div2").remove();
              var newHtml = jHtmlObject.html();
              console.log(newHtml);
  </code></pre>
  
  <p>Why doesn't this return anything in the console?</p>
  
  <p>Update2!: 
  I have made a jsFiddle to make my problem visual..
  <a href="http://jsfiddle.net/WGXHS/" rel="nofollow">http://jsfiddle.net/WGXHS/</a></p>