title: How to find first parent element in jquery
body: <p>Conside below html -</p>
  
  <pre><code>&lt;div class="container1"&gt;
     &lt;div class="container2"&gt;
        &lt;div class="container3"&gt;
           &lt;div class="container4"&gt;
               &lt;div class="element"&gt;
               ...
           &lt;/div&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>if I want to get <code>&lt;div class="element"&gt;</code> element and I have reference to the <code>container1</code>. In jquery what I do is,</p>
  
  <pre><code>$(".container1").find(".element")
  </code></pre>
  
  <p>instead of -</p>
  
  <pre><code>$(".container1").children().children().children().find(".element")
  </code></pre>
  
  <p>This is process to find any child element when I have reference to any of the parent element. But instead when I have reference to a child element and want to get parent element then every time I have to go one level up -</p>
  
  <pre><code>$(".element").parent().parent().parent().parent()
  </code></pre>
  
  <p>and I can't do like this -</p>
  
  <pre><code>$(".element").findParent()
  </code></pre>
  
  <p>I have not come across any method like findParent() in jquery. Is there which I am not aware of? Or is it not there for some reason?</p>