title: Replacing the inner.html of an unknown named element based on condition
body: <p>I run into this problem frequently and never know the best approach. Imagine I have a structure that includes several instances of the following html:</p>
  
  <pre><code>&lt;div class="known"&gt;
      &lt;div class="another unknown"&gt;
          &lt;div class="unknown"&gt;
              &lt;h4&gt;Something a something&lt;/H4&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>For each div of class known, I want to change the inner html of that div only if it contains a div inside it with some particular tag, in this case <code>&lt;h4&gt;</code>.</p>
  
  <p>What is the best way to achieve that.  I know that I could do it by taking the inner html of class known and doing a regex match. But is there a more robust way based on tags?</p>