title: How to get the immediate parent element containing a character found with :contains in jQuery?
body: <p>I need to find certain characters and strip them out.  I know I can do this with</p>
  
  <pre><code>$('.identifiable-selector:contains("x")').each(function() {
      $(this).html($(this).html().split("x").join(""));
  });
  </code></pre>
  
  <p>however the character may appear in a few different places, so I have to choose a starting point for the <code>:contains</code> that is fairly high in the hierarchy.  What I want to do is start the <code>:contains</code> search high enough that I know I will find the character wherever it is, but I only want to do the stripping / HTML rewriting at the highest level necessary (meaning, somewhere lower than where I start my search).</p>
  
  <p>For instance, in this case</p>
  
  <pre><code>&lt;div class='identifiable-selector'&gt;
      &lt;div&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      content content x content
                      &lt;div&gt;
                          &lt;div&gt;content x content&lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/td&gt;
  </code></pre>
  
  <p>I need to start my search at the <code>.identifiable-selector</code> level, but I want to get ahold of the <code>td</code> that is the highest level of elements that actually contain <code>x</code> so that I only have to rewrite that HTML.</p>
  
  <p>How can I do that with jQuery?</p>